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();

        InitCommon();
        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);
myPalette.Document.Add(n);
n = new GraphNode(GraphNodeKind.Decision);
myPalette.Document.Add(n);

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.
Regards

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.

see http://www.nwoods.com/forum/forum_posts.asp?TID=1745

Thats great! Thanks Jake, got that working.