This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I'm working on Copy/Cut/Paste funcitonality of my nodes within a diagram. I have noticed that DiagramNodeBase.Clone() returns a IDiagramNodeState of the node being cloned, but .Equals() returns true indicating it is still referencing the same data for Data, Bounds, Parent, etc. of the node being cloned. Is this by design? I am assuming we need to override Clone() to provide our own implementation of deep node cloning? Edit: Noticed that IDiagramNodeState.Apply() seems to properly clone Bounds, Parent and ZOrder, but not Data. I assume this is because Data is an object we assign that can be ANYTHING, therefore we need to implement our own Data object cloning. Let me know if my assumptions are correct or not. |
|
|
Hello The Clone method is actually used by the built in undo/redo system. This is why it does not need to deep clone the members because an undo operation simply restores the previous state of a node. You should be able to extend the cloning to further clone data values for your copy/paste feature, though I've never tried it before. If you find that there are problems doing it this way, it shouldn't be hard to implement it from scratch. Jason Fauchelle |
|