Re: dismissing sheets.
Re: dismissing sheets.
- Subject: Re: dismissing sheets.
- From: j o a r <email@hidden>
- Date: Fri, 7 Feb 2003 16:23:24 +0100
Please look in the list archives for similar discussions. The general
message here is: "Don't mix code for running non-sheet-modal-panels
with code for running sheets".
I have changed your code into something that might work:
====================================
/*
- (void) windowDidEndSheet:(NSNotification *)notification
{
[NSApp stopModal];
}
*/
- (void) sheetEnded: (NSWindow *)sheet returnCode: (int)returnCode
context: (void *)contextInfo
{
[NSApp endSheet: sheet];
[sheet orderOut: self];
}
- (void) awakeFromNib
{
#if 1
// [self setDelegate: self]; // WTF???
#else
// [[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(windowDidEndSheet:) name:
NSWindowDidEndSheetNotification object: self];
#endif
}
- (BOOL) editPlayerOptions: (PlayerSelectionData *) player
{
id sheet;
if ([player isKindOfClass: [HumanPlayerSelectionData class]]) {
sheet = human_options;
} else if ([player isKindOfClass: [ComputerPlayerSelectionData
class]]) {
sheet = computer_options;
} else {
return NO;
}
// [self setDelegate: self]; // WTF???
[NSApp beginSheet: sheet
modalForWindow: self
modalDelegate: self
didEndSelector: @selector(sheetEnded:returnCode:context:)
contextInfo: nil
];
// [NSApp runModalForWindow: sheet]; // No, no, no...
return YES;
}
====================================
j o a r
_______________________________________________
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.