Re: Closing windows bearing sheets
Re: Closing windows bearing sheets
- Subject: Re: Closing windows bearing sheets
- From: Kurt Revis <email@hidden>
- Date: Mon, 4 Mar 2002 14:51:55 -0800
On Monday, March 4, 2002, at 02:06 PM, email@hidden wrote:
You can see what I mean by opening TextEdit, creating 2 new documents,
choosing Page Setup for one of them and option-clicking the close
widget
of the other. This will close the 2 windows, including the one which
was
displaying the Page Setup sheet. Trying to quit TextEdit now wouldn't
work.
Step 1. Log a bug on Apple.
Step 2. Wait for Apple to fix it. :->
Here is an easy workaround for the problem. In your window controller,
in -windowShouldClose, if [[self window] attachedSheet] is not nil,
return NO.
I just changed TextEdit's Document.m:
- (BOOL)windowShouldClose:(id)sender {
if ([[self window] attachedSheet]) {
NSLog(@"sheet attached, so don't close");
return NO;
}
return [self canCloseDocument];
}
I ran my new TextEdit, created two new windows, opened the Page Setup
sheet on one, and option-clicked the close button of the other. Only
the second window got closed, and the NSLog showed up as expected.
(I can't find any bad ramifications of this workaround, but if there are
any, they are probably pretty subtle... speak up if you know of any.)
--
Kurt Revis
email@hidden
_______________________________________________
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.