Removing a link from document


#1

I have overriden the OnLayerChanged from the GoLabeledLink class…so that when a link is created and the creation is undone and redone (add and remove on the document), the link doesnt lose its ports… but if i create a Link… Undo the creation… move one of the nodes and Redo the creation… the link points to the old node position…is there a way to refresh the link after its been added to the document?


#2

Well, I hope you recognize that what you’re trying to do isn’t normally supported by undo-redo mechanisms, because you are inserting additional changes into the middle of the sequence. This can cause arbitrarily bad problems, because the later changes might depend on the earlier ones and no other changes.
Now in the case that you cite, moving a node isn’t that big a deal. You could certainly call GoLink.CalculateStroke() to make the link reroute itself.
I don’t have any understanding of what you’re really trying to do, but my impression is that you’re trying to get two separate undo-redo mechanisms to co-exist while operating on the same objects. I believe such an effort is likely to be unnecessarily difficult. It would be better to just use one mechanism. You don’t have to use the one that GoDiagram provides, but you would need to re-implement more stuff that way.


#3

The thing is…i dont only have a GoDiagram view in my application… and i surelly will not use the GoUndoManager to execute my application commands… the thing is i probably will have to implement the move undo/redo myself because it doesnt seem to be easy to mix to undomanagers… its already been done but in a case where i dont want to wrap every command…its looks like a pain.