Hello! My question is specifically related to the goView1_DocumentChanged method of the DataSet Demo. Let’s say I want to check each inserted or deleted item when it is added/removed from the Document. Would I just use the GoDocument.ChangedObject case? If so how would I pass the object I need to make changes on or detect it? Sorry this is pretty vague, but I somehow managed to get my app working without taking this into account, but now I have to really get a hold of how to control the adding/removing of objects to the document.
GoChangedEventArgs.Hint == GoLayer.InsertedObject, or == GoLayer.RemovedObject
Thanks Walter! Besides a bool, how would I differentiate between nodes and links that are being drawn on initial diagram opening, and new nodes or links added after the fact. Well is there a better way to differentiate between them?
There’s no intrinsic difference between objects created programmatically and objects created because the user drag-dropped them or drew them using some tool. That’s because, ultimately, nothing happens unless some code executes.
Nevertheless, there are various ways of marking certain objects so that you can distinguish ones created before a particular time from those created after a particular time. You could certainly set a flag in the UserFlags property that all nodes and all links have. Or set a value in the UserObject property. Or set some property that you define in your own subclasses.
Another possibility is to keep all the initial objects in a separate GoLayer, one that is neither the GoDocument.DefaultLayer nor the GoDocument.LinksLayer. (You could even turn off user abilities on that layer, such as setting GoLayer.AllowDelete to false. But I don't know if that's something that you would want.)