Custom Object Associated with GraphNode Issue

Hi All

I am using the GraphNode class as found in the Demo Project - FlowCharter.

I have also created a custom class which holds details which I need to store against each GraphNode. This class just contains a few string and int fields. When I initialise a new GraphNode I initialise the custom object like so:

<span =“Apple-tab-span” style=“white-space:pre”> public GraphNode(GraphNodeKind k)
//Initialise my custom object
fORPSettings = new GraphNodeORPSettings();

        this.Kind = k;

        fORPSettings.Description = this.Text;

When my app starts I create a GoPalette and add two GraphNode types like so:

<span =“Apple-tab-span” style=“white-space:pre”> GraphNode n;
n = new GraphNode(GraphNodeKind.Step);
n = new GraphNode(GraphNodeKind.Decision);

Now when I create a Document and drag these node types onto the document I have the ability to edit my custom properties via a propertyGrid. The issue is that If I edit one node’s custom properties, all the other nodes of this type get updated to, like they’re all the same object?

I would have thought that when I drag a GraphNode onto the document it creates a new instance of the GraphNode object? If not, how do I initialise a new instance of the object each time it’s added to the document?

Any help appreciated.

I had a thought, would I need to override the event which is fired when a new node is dragged onto the document, and then add a new GraphNode object at the point at which the user drops the GraphNode?

I can’t seem to find an override which suits this, or I’m missing it.


Thats great! Thanks Jake, got that working.