Re: How to intercept save panel?
Re: How to intercept save panel?
- Subject: Re: How to intercept save panel?
- From: Marcel Weiher <email@hidden>
- Date: Sun, 11 May 2003 17:10:13 +0200
On Sunday, May 11, 2003, at 02:23 Uhr, Bill Cheeseman 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.
Is this the best or "right" way to do this? A potential downside is
that I
won't be able to call -shouldCloseDocument just to see what its value
is,
but I can live with that.
Well, you don't have to live with that:
-(BOOL)baseShouldClose
{
return [super shouldClose];
}
-(BOOL)shouldCloseDocument
{
// run sheet
return [self baseShouldClose];
}
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.