I’ve implemented a context menu based off of the FlowCharter example. Everything works fine except when I right click for the context menu, the context menu appears outside of the GoView above the border at the top. The context menu does move to the correct X location I click, but the Y location is always outside the view at the top. I haven’t modified any settings for the context menu except the menu items. Any ideas on why this happens?
So you construct and initialize a new [Go]ContextMenu and return it from an override of GoObject.GetContextMenu?
Or do you implement a GoView.BackgroundContextClicked and/or GoView.ObjectContextClicked event handler and explicitly call ContextMenu.Show, passing it the GoInputEventArgs.ViewPoint? If you are passing ContextMenu.Show a point in document coordinates, that would be incorrect.
I also tried implementing context menus like in the Processor example, by overriding the GetContextMenu within a GoIconicNode class. Once again everything works fine except the location of the ContextMenu.
There are several examples of calling GoContextMenu.Show – basically they pass the GoView as the first argument and GoInputEventArgs.ViewPoint as the second argument.
My GoContextMenu does not contain a definition for Show()…
And I can’t seem to find the definition anywhere else in the help files. Am I missing something? Can you point me to a specific example that came with the installation.
GoContextMenu inherits from System.Windows.Forms.ContextMenu, which defines “void Show(Control, Point)”.
In the FlowCharter sample, GraphView.OnBackgroundContextClicked constructs a GoContextMenu and calls its Show method.
Or are you using ASP.NET and GoDiagram Web? Obviously there can’t be a “Show” method on the server. But the “goShowMenu” JavaScript function running on the client is what actually positions the DHTML context menu and makes it visible.
I’m using ASP.NET. I just figured out why the coordinates are off. I have the GoView layout set to Absolute, which throws the coordinates off. But when I set it to Static/Not Set, the context menu shows up correctly. Is there a workaround for this, or should this not even be happening.
I found a solution by setting the Layout to Relative, and setting the z-index to 0. I tried Relative Layout before, but it didn’t seem to work because the z-index was greater than the context menu’s layer so it never showed up.