Hi,
When a group of nodes are selected, and a context click is made on the background (not on one of the selected nodes) the view’s Selection.Count property returns 0.
Is there something I can do about to avoid this? That is, when a context click is made, the selection should be maintained.
There is a reference to similar problem in the FAQ, viz. ,
Bringing up a popup menu on a context click causes other selected objects to be deselected—how can I have the popup menu apply to all selected objects?
However, this assumes that the context click is being made on one of the selected objects and hence, doesnt seem to be working in my case.
Am I right or am I missing something?
-Thanks
Yes, that was intentional. Normally when you click in the background, it causes the selection to be cleared, and the same is true for context clicks. Also, when you click on an object that is not selected, including context-clicking, I would think you would want the selection to change to just be that one object.
But you can certainly program whatever policy you like. In your case I think you just need to override GoToolContext.DoSelect to be a no-op if this.View.PickObject(true, false, evt.DocPoint, true) returns null; otherwise you can call the base method.
I assume you know how to replace the standard GoToolContext tool with your customized one:
goView1.ReplaceMouseTool(typeof(GoToolContext), new MyContextTool(goView1))