I have an application that has multiple GoDocuments and a single UndoManager.
How does it “get in the way”? Maybe there’s another solution…
<span =“apple-style-span”="">For example: if there is a current edit pertaining to only one document (Undomanager.CurrentEdit != null) , GoDocument.IsModified <span =“apple-style-span”="">returns true for ALL document instances.
<span =“Apple-style-span”>Even for the documents <span =“Apple-style-span”>that are not involved in the edit.
<span =“Apple-style-span”>After the edit has been committed, IsModified for the documents <span =“Apple-style-span”>that have not been changed returns false again.
The reasoning is that if multiple GoDocuments are sharing a GoUndoManager, the documents probably have implicit dependencies between them. So for example it wouldn’t make sense to try to save one GoDocument without saving the rest of them, because that would be incomplete and potentially inconsistent. The real “document” has been split up in multiple GoDocument instances.
This way if you have multiple GoViews or other controls that are displaying the state of any of the GoDocuments, they will all be consistent regarding whether the document has been “modified”.
But I don’t see any harm in making the property virtual.
Understood, but I still don’t see why IsModified would return true for all documents while there is an edit in progress, and return false for unaffected documents after the edit has finished.
Anyway, a virtual IsModified property would make my code a lot cleaner.
Any further thoughts on this ?
I am still relying on reflection to access the GoDocument.myisModified flag.
A virtual GoDocument.IsModified would make my code A LOT cleaner.