Leaving Modal Loop with Sheets
Leaving Modal Loop with Sheets
- Subject: Leaving Modal Loop with Sheets
- From: mw <email@hidden>
- Date: Sun, 06 Oct 2002 21:11:51 -0400
Hey again everyone,
I have a custom sheet (from a nib) that drops a-okay, and has all of its
events handled okay by its window controller. Whenever the sheet is
dismissed, it seems to retain the modal loop that the app was in for the
sheet, so it beeps whenever anything is clicked and the table stops working
completely.
Here is the call I am using to show the sheet:
[NSApp beginSheet:[self window]
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:nil];
(Remember, this is in a subclass of NSWindowController that controls the
sheet window).
Here is the implimentation of the sheetDidEnd: method...
- (void)sheetDidEnd: (NSWindow *)sheet returnCode: (int)returnCode
contextInfo: (void *)contextInfo
{
NSLog(@"Alert sheet ended.");
[NSApp stopModal];
}
And when the OK button is pressed in the sheet, this function is called:
- (IBAction)closeWindow:(id)sender
{
// Hide the sheet
[[self window] orderOut:sender];
// Return to normal event handling
[NSApp endSheet:sender];
}
But again, it never seems to leave the modal loop that the sheet was in
after the sheet is dismissed. Am I missing something in my code somewhere?
-- mw
_______________________________________________
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.