NSDocument updateChangeCount : unexpected behavior
NSDocument updateChangeCount : unexpected behavior
- Subject: NSDocument updateChangeCount : unexpected behavior
- From: Michael McCracken <email@hidden>
- Date: Mon, 1 Apr 2002 16:28:06 -0800
I just ran into this weirdness with NSDocument: if you have a freshly
opened document with no changes, and call [doc
updateChangeCount:NSChangeUndone] (to unset a change) - it behaves
exactly as if the argument had been NSChangeDone - the window is marked
as changed and the user is prompted to save on a close.
Essentially, there seems to be no floor at zero as I expected. This is
easy enough to hack on, just by checking the change count before
decrementing it, and that's what I did, but still...
I suppose no one expected someone to be using it like that. The context
might clear up why I was manipulating it directly: I have a document
class that manages a collection of document-like objects, and I wanted
the dirty-document behavior in both, and for the managing document to
reflect changes made in the managed documents.
This isn't covered in the documentation or in the comments in
NSDocument.h - I think it's something that could be better explained.
Could this be useful, or should I have just seen "results of sending
NSChangeUndone to an unchanged document are undefined" somewhere else?
Anyone think I should file a bug (at least on the documentation?)
-mike
--
Michael McCracken
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.