Walter,
I was also wondering what I could do about detecting whether or not the user was right clicking on a node or just somewhere on the view/document where there is empty space.
Right now I have my context menu working but only when the user right-clicks on an actual node. If they right-click in an empty area a runtime error is generated b/c I am overriding the GetContextMenu() method in my custom GoTextNode and in it I refer to the node itself using "this.SomeProperty". Since there is no "this" b/c the user didn't right-click on a node I get the error.
Since the eventhandler is triggered using OnBackgroundContextClicked, I would like to perform some form of validation to see if there is a GoObject at the particular coordinates that the user clicked.
Could I do something like:
Point pscreen = goView1.PointToScreen(goView1.LastInput.ViewPoint);
Point p1view = goView1.PointToClient(pscreen);
PointF p1doc = goView1.ConvertViewToDoc(p1view);
GoObject obj = goView1.PickObject(true, false, p1doc, true) as GoObject;
if (obj is PersonNode) {
PersonNode node = obj as PersonNode;node.ShowContextMenu(goView1);
}
I haven't tried this yet but I was wondering if I am headed in the right direction?
Thanks!