Re: end of sheet and re-activationg window
Re: end of sheet and re-activationg window
- Subject: Re: end of sheet and re-activationg window
- From: Christopher Corbell <email@hidden>
- Date: Tue, 5 Nov 2002 09:29:10 -0800
On Tuesday, November 5, 2002, at 07:13 AM, matt neuburg wrote:
On Mon, 4 Nov 2002 22:40:12 +0100, Yann Bizeul <email@hidden> said:
I have a little problem using alert sheet : All works
fine but when I clic "OK" to close the sheet, the window
does not seem to come back in front, their buttons are
gray, and the textField I just hilighted is gray.
I just saw this yesterday. I think there's a bug in the AppKit, or
even the system. Unfortunately I can't reproduce it today. :(
If you try the minimal button-driven code for showing and hiding a
sheet:
- (IBAction)showPanel:(id)sender
{
[NSApp beginSheet:myPanel modalForWindow:[sender window]
modalDelegate:nil didEndSelector:nil contextInfo:nil];
}
- (IBAction)hidePanel:(id)sender
{
[NSApp endSheet: [sender window]];
[[sender window] orderOut: self];
}
...you'll notice there's a significantly long delay between the time
the sheet vanishes and the time the window behind it recovers its
status as main window (the selection comes back, the titlebar becomes
opaque, and so on). It's as if the window is struggling to come back
into focus. I think sometimes it just loses this battle, but I can't
specify when that happens. m.
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
I believe you need to call two other NSApp functions as well -
runModalForWindow and stopModal.. I use the code
below to end sheet display, and I haven't seen this problem.
--- showing the sheet:
[NSApp beginSheet:aWindow
modalForWindow:aHostWindow
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
[NSApp runModalForWindow:aWindow];
--- hiding the sheet:
[NSApp endSheet:aWindow];
[aWindow orderOut: self];
[NSApp stopModal];
Perhaps that will fix it.
- Chris Corbell
_______________________________________________
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.