Re: [semi-newbie] Message sent to NSWindowController after
Re: [semi-newbie] Message sent to NSWindowController after
- Subject: Re: [semi-newbie] Message sent to NSWindowController after
- From: mw <email@hidden>
- Date: Fri, 04 Oct 2002 17:01:09 -0400
On 10/3/02 8:50 AM, "email@hidden"
<email@hidden> wrote:
>
mw
>
>
You might want to try adding something like the following to your
>
window controller
>
>
- (void) windowDidLoad {
>
// other windowDidLoad code here
>
[self performSelector:@selector(showSheet:) withObject:nil
>
afterDelay:0];
>
}
>
>
- (void) showSheet: (id) something {
>
// Code to show the sheet here
>
}
>
>
This will cause -showSheet: to be called as soon as the app drops into
>
its runloop, by which point the window should be visible.
>
>
I hope this is of some help
>
>
Simon
Well, I found the problem (btw, thanks for everyone's advice). It was just
one of those stupid mistakes that everyone makes every once and awhile. I
forgot to load the nib file with the sheet window from the application's
bundle. Doh! But now it works... Sorta.
Now that the sheet finally drops and everything, another problem has arisen.
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?
TIA,
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.