LimitingSubGraph context menu

In NodeLinkDemo you can copy a node. Then with the mouse hovered over the LimitingSubGraph, you can rightclick and get the View’s context menu so that you can paste the node. In my project I can copy a node but when I hover over the LimitingSubGraph and rightclick I do not get the context menu to popup to paste the node into the LimitingSubGraph. However, If I hover over the View and rightclick I get the context menu and can paste the node into the view. It appears like the LimitingSubGraph obsures the view’s background so that the rightclick is not detected. Any idea as to how/why this works in the NodeLinkDemo? That is the behavior I want.

Have you added a background object to the subgraph?

Yes, I have a GoRectangle that covers the entire LimitingSubGraph. It is there so I can set the background color. So, that makes sense that the GoRectangle occludes the view from getting the click event. Do you know of a workaround?

You can set BackgroundColor, BorderPen and Corner properties in GoSubGraph to affect appearance without adding a background object.

And GoObject has context menu support, so you could add that to your rectangle if for some reason you need to keep it.

Thanks Jake. As it turns out I do need my GoRectangle. I have tried to add a context menu and I get the “Paste” option to display. However, when I click it it does not add another Node to my SubGraph. But when I click directly on the View it does. Below is the code snipet:

In LimitingSubgraph
public override GoContextMenu GetContextMenu(GoView view) { if (view is GoOverview) return null; GoContextMenu cm = new GoContextMenu(view); if (view.CanEditPaste()) cm.MenuItems.Add(new MenuItem("Paste", new EventHandler(this.Paste_Command))); return cm; } public void Paste_Command(Object sender, EventArgs e) { GraphView v = new GraphView(); v.GetView.EditPaste(); }

I tried
GoContextMenu cm = myBorder.GetContextMenu(view);

but it returned null. Any help would be appreciated.

I found my problem, Thanks for your help. Here’s the change I made to fix the problem:
public void Paste_Command(Object sender, EventArgs e)
GoView v = MainForm.App.GetCurrentGoView();