Re: orderOut a sheet while app is hidden
Re: orderOut a sheet while app is hidden
- Subject: Re: orderOut a sheet while app is hidden
- From: Matt Covey <email@hidden>
- Date: Mon, 9 Dec 2002 21:05:21 -0800
Nico,
I just ran into this as well.
The root of the problem is that when an application is hidden "orderOut:" has no effect.
So your sheet-ending code runs like normal and your program continues on it's merry way, thinking it's gotten rid of the sheet. But when the app is finally unhidden the windows that were originally present are restored, including the sheet.
My solution was to test just before doing the "orderOut:"
if( [win isVisible] ) // is on screen
[win orderOut: self]; // can get rid of it now
else // is hidden
{ // so have to get rid of it later
[self setOrderOutNeeded: YES]; // (set our internal flag)
if( ! [self haveAddedAsUpdateObserver] )
{
[self setHaveAddedAsUpdateObserver: YES];
[[NSNotificationCenter defaultCenter]
addObserver: ...
selector: ...
name: NSWindowDidUpdateNotification
object: ...
];
}
}
and then the observer method does the "orderOut:" (testing for the flag, the right window and that it's visible, of course).
++matt
>
Hi folks!
>
>
I use a sheet that shows the state of a calculation.
>
It closes automatically on finished.
>
To close the sheet I call:
>
>
[Application endSheet:processSheet];
>
[processSheet orderOut:nil];
>
>
It works fine until I hide (Command-H) my app.
>
When I go back to the app after the calculation has
>
finished, the sheet is still there blocking the app.
>
>
Maybe its a problem doing these actions off-screen?!
>
>
Since early, Nico.
>
_______________________________________________
>
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.
_______________________________________________
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.