How do I get a port to generate a part id


I have a GoNode based object that I have added a single GoPort to. This works fine, however, the port still has a partid of -1, unlike the other objects/ports whose partid’s are managed by the document.
I add the port to the control, but not the document, is this the problem?
Also, the node is initially added to a toolbox, so I would have to add the port to the document as part of the drop event I think, is this right?
Any help would be greatfully recieved,


As each IGoIdentifiablePart is added to a GoDocument whose MaintainsPartID property is true, it will get its PartID property assigned a unique value. GoDocument automatically checks all parts of groups, recursively, so you don’t need to worry about the port being a part of a node.
So if you added an object to a view, by something like GoView.Layers.DefaultLayer.Add(…), the document wouldn’t know about that object and thus couldn’t assign an ID that was unique within the document.