Raise an OnDocumentChanged event?


#1

How could one raise an OnDocumentChanged-event?

I have to know this because I have dialogs containing

data related to the nodes. And if I change the data

in the Dialog I have to raise an OnDocumentChanged-Event I guess. Because my view should know that that the Document has been changed.

Momentarily I try to move the nodes one point forth and back to achieve this.

Seems not to be good to me…




#2

The DocumentChanged event on GoView is just passing through the Changed event from the view’s GoDocument.
So the question is really: How can I raise a GoDocument.Changed event?
The answer is by calling GoDocument.RaiseChanged, or more commonly, by calling GoObject.Changed. Practically all of the property setters for GoObject its subclasses call GoObject.Changed. You can read more about this in the Event Handling section in the description of GoObject in chapter 4 of the User Guide. You can also look at the sample classes that define their own properties.
Thus if you have added some properties that should be reflected in a GoDocument, you just need to modify the appropriate GoObject(s) or GoDocument. You can also read the entry in the FAQ about: “I want to have a text object display the value of a variable that changes.”