• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Field editor undo vs document dirty
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Field editor undo vs document dirty
      • From: "Adam R. Maxwell" <email@hidden>
    • Re: Field editor undo vs document dirty
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Re: NSWindow from code
  • Next by Date: Re: No more crash logs since 10.5.6 ?
  • Previous by thread: Re: New question about borken NSOperationQueue
  • Next by thread: Re: Field editor undo vs document dirty
  • Index(es):
    • Date
    • Thread