Re: How do I replace the "Do you want to save changes...?" sheet?
Re: How do I replace the "Do you want to save changes...?" sheet?
- Subject: Re: How do I replace the "Do you want to save changes...?" sheet?
- From: Dan Bernstein <email@hidden>
- Date: Mon, 19 Nov 2001 22:58:39 +0200
Mark,
Many thanks for your reply. Actually, your code is just what I had in
mind when I asked the original question. As for my motivation to replace
the "Do you want to save..." alert I didn't want to give up on using
NSDocument just because my users don't think of their documents as
"documents".
BTW, I've seen this many times:
if (inAlertSheet) [inAlertSheet orderOut:self];
and wondered when a sheet is created by NSBeginAlertSheet, does
orderOut:ing it also releases it? If not, then how, when and by whom is
it released eventually?
Thanks again,
-- Dan
On Monday, November 19, 2001, at 08:53 PM, Mark Piccirelli wrote:
>
Dan --
>
>
Replacement of the "Do you want to save the changes..." alert is not
>
one of the customizations of NSDocument we've anticipated, so it's no
>
fun to do, but I think there is a way to do it that's not likely to
>
break when run against future Mac OS X releases.
>
>
It sounds like you really should override -[NSDocument
>
-canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:].
>
Here's some sample code to walk you through it. It's very similar to
>
what NSDocument itself does. You have to override the method itself,
>
provide another method that will be invoked after the alert sheet has
>
been dismissed, and declare a context structure just to remember a
>
little bit of stuff while the sheet's being presented. I haven't
>
actually compiled this code, so anything that looks like a typo
>
probably is.
>
>
-- Mark