Node issues with shared references

2.4.1 GoDiagram

I was hoping I would come up with some solution but I seem to be having problems when I have two GoBasicNode which share an embedded object reference.

i.e. rough pseudo code for simplicity

class DerivedNode : GoBasicNode

public MyObject myObject;



MyObject sharedObj = new MyObject ();

DerivedNode a = new DerivedNode ();
DerivedNode b = new DerivedNode ();

a.myObject = sharedObj;
b.myObject = sharedObj;

Document.Add (a);
Document.Add (b);

The problem I am seeing is that both nodes are displayed in the view. However, if I select one of the nodes and try to drag it within the view the other node disappears or the drag operation seems to operate on a different axis and drags the item right off the screen.

As said before it is all a bit confusing and the above is the only way I can explain it - as it only manifests itself when shared references occur - which is valid for my application. If you have any ideas or thoughts like well that could only happen if you’ve overriden this event or interface - been tugging my hair out this week trying to resolve so thanks for any help in advance.

You say that the problem only happens when DerivedNode.myObject has been initialized to a shared object. How is that field used? Surely its presence can have no effect unless there is some code doing something based on the value.
What kind of object is MyObject? It’s unlikely to be a GoObject. Is it something that when modified will change the position of a GoObject?

Found the problem, embarassing as school boy stuff - but thats what happens when you inherit others code. The issue was that the nodes’ Equals method had been overriden to use the identifier of sharedObj. Unfortunately the developer didnt realise this could be a shared object and hence the problems when multiple instances were created. Anyway, thought I’d let you know best to learn from other folks mistakes than your own