I have a GoNode object removed out of a subgraph, and delete that node using base.DeleteSelection and call the refresh after that. The view/document does delete the object, but the view keeps a green rectangle on the last position of the node in the view. Can someone shed some light on how to make that green rectangle ?
Why do you call StartTransaction/FinishTransaction twice each? Once each should be sufficient.
You shouldn’t be constructing a GoSelection. But if you do, you probably shouldn’t be passing the GoView as the GoSelection constructor argument – you should use null instead. However, the main point, that you probably shouldn’t be constructing a GoSelection at all, is important.
I can understand your wanting to “reparent” the selected nodes to be part of the document instead of being part of the subgraph. However, I don’t understand why you then delete them.
I think your command should just be defined as:
[code] public override GoContextMenu GetContextMenu(GoView view) {
GoContextMenu cm = new GoContextMenu(view);
if (view.CanEditDelete())
cm.MenuItems.Add(new MenuItem(“Delete”, new EventHandler(this.DeleteMenuItem_Click)));
. . .
}
private void DeleteMenuItem_Click (object sender, System.EventArgs e) {
GoView v = GoContextMenu.FindView(sender as MenuItem);
if (v != null)
v.EditDelete();
}[/code]
This code is taken from the LimitedNode example class in Demo1. There are other examples of this, too, I believe.
This is all code you could add to your GoSubGraph-derived class. If you don’t want to define a node class, you can put similar code in a view event handler.