Field editor undo vs document dirty
Field editor undo vs document dirty
- Subject: Field editor undo vs document dirty
- From: Quincey Morris <email@hidden>
- Date: Mon, 6 Apr 2009 23:52:45 -0700
I can't work out if this simple and I'm just missing it, or if this is
hard ...
In a NSDocument-based application, I have some text fields in the
document window. Typing in one of these text fields (that is, typing
characters but not pressing Tab or Return to end editing) is of course
undoable by default (Undo Typing), but typing does not cause the
document to be marked dirty.
The first thing I don't understand is whether that's a bug. Although
the document isn't really changed (because the typing hasn't been
committed yet), but the presence of undoable typing perhaps ought to
prevent the document window from closing without first asking whether
to save the changes.
The second thing I don't understand is how to make that happen.
Committing the change in windowWillClose: doesn't help because by the
time that's called the decision whether to save has already been
taken. Perhaps its as simple as overriding the close:, saveDocument:
and saveDocumentAs: actions to first commit pending edits in suitable
text fields, but it's not clear how easy it is to detect and cover all
the necessary cases.
Can anyone explain the simple answer to me, or suggest a strategy if
the answer isn't so simple?
_______________________________________________
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