Re: NSDocument's isDocumentEdited
Re: NSDocument's isDocumentEdited
- Subject: Re: NSDocument's isDocumentEdited
- From: Graham Cox <email@hidden>
- Date: Sun, 20 Jul 2008 22:17:56 +1000
Normally you "tell" a document that it is edited in one of two ways -
either a) by maintaining an Undo stack in which case it "just works",
and b) by calling -updateChangeCount: The method you mention is a
lower level method that is not meant to be overridden, as far as I'm
aware. If you use -updateChangeCount: the window dirty state is
handled for you - if not using Undo then you'd just call this for each
change of state in your data model that should mark the document dirty.
hth,
Graham
On 20 Jul 2008, at 9:31 pm, John Love wrote:
Within MyDocument's isDocumentEdited I have code to determine whether
MyDocument is edited and return the BOOLean flag accordingly.
I then discovered that the only way to set the window's "dirty" flag
was to
*explicitly* call [window setDocumentEdited:editedFlag] within other
methods
by duplicating the same code I have in MyDocument's isDocumentEdited
method,
followed by setDocumentEdited on the window.
My "off the wall" guess *was* that Cocoa's main event loop called
isDocumentEdited and then set the window to "dirty" if needed. This
guess
is wrong, or otherwise I would not have had to set the window to
"dirty"
elsewhere.
Anyone have a clue here?
Cheers, John Love
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden