Re: How to intercept save panel?
Re: How to intercept save panel?
- Subject: Re: How to intercept save panel?
- From: Bill Cheeseman <email@hidden>
- Date: Sun, 11 May 2003 09:05:44 -0400
on 03-05-11 8:23 AM, Bill Cheeseman at email@hidden wrote:
>
When the user closes a document window in my document-based application, I
>
would like to present a sheet BEFORE the application decides whether there
>
are unsaved changes requiring it to present a save panel. In my sheet, the
>
user might make changes that would dirty the document, so my sheet has to
>
come up before the window even thinks about whether it needs to present the
>
save panel.
>
>
The best I have come up with is to override NSWindowController's
>
-shouldCloseDocument, returning [super shouldCloseDocument] when I'm done
>
with my own sheet. This method is apparently called (obviously) before the
>
save panel is presented.
A more serious, perhaps fatal, problem with -shouldCloseDocument is that it
doesn't appear to get called at the right time when I quit the application
with two dirty documents open. First, I get the alert panel telling me that
2 unsaved documents are open and asking me if I want to review them. But
when I click to review them, each dirty document immediately puts up its own
save sheet BEFORE calling -shouldCloseDocument. As a result, my own sheet
gets called AFTER the save sheet is presented in the quit scenario, which
isn't a workable user experience.
I'll try NSDocument's isDocumentEdited.... Nope, same problem when quitting
with multiple unsaved documents open. (Also, it's called when a window is
first opened, presumably to decide whether to display the dirty-dot in the
close button. I could work around that.)
So I do need another solution.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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.