Re: Sheets and hidden apps
Re: Sheets and hidden apps
- Subject: Re: Sheets and hidden apps
- From: John Stiles <email@hidden>
- Date: Wed, 3 Nov 2004 14:50:49 -0800
I was able to come up with a workaround, but it'd be nice if someone
could confirm that this is an AppKit problem.
I'll make a test app and get this on Radar shortly. It'd be really nice
if it were fixed for Tiger.
void InstallerHideProgress()
{
[s_installer performSelectorOnMainThread:@selector(progressSheetHide:)
withObject:NULL waitUntilDone:YES];
}
- (void) progressSheetHide:(id)object
{
// AppKit has a bug where if you try to roll up a sheet on a window
and the app is hidden, it will unhide the app
// but the sheet won't roll up. If you manually set the app to
frontmost (by key-and-order-fronting the parent window),
// that isn't quite good enough either. You have to set the app to
frontmost, give the event system time to actually
// bring the window frontmost--that actually happens a little later,
after you relinquish control to the event loop--
// and after that's done, THEN you can roll up the sheet and it will
actually work. Gah!
[_window makeKeyAndOrderFront:self];
// Actually roll up the sheet 1ms later.
[s_installer performSelector:@selector(progressSheetHidePhase2:)
withObject:NULL afterDelay:0.001];
}
- (void) progressSheetHidePhase2:(id)object
{
// See above ranting (err comments).
[NSApp endSheet:_progressSheet returnCode:0];
[_progressSheet orderOut:self];
}
On Nov 3, 2004, at 11:33 AM, John Stiles wrote:
My installer app has a sheet that shows progress. It drops down, my
app does its work while the progress bar fills up, and then when my
app is done it rolls up the sheet.
I've had some end users report that they'll start an installation,
hide my application (via cmd+H), come back to it later and the install
has completed 100%, but the sheet is still there. I know that my app
has asked to hide the sheet because the parent window behind the sheet
has been updated :) It works fine if you don't hide the app.
Here's the code in question. Why is this happening? It's occurring in
10.3.5.
PS yes, the variable naming conventions suck a bit; if I redid it
today they'd be named differently. Whatever. :)
void InstallerShowProgress()
{
[s_installer
performSelectorOnMainThread:@selector(progressSheetShow:)
withObject:NULL waitUntilDone:YES];
}
void InstallerHideProgress()
{
[s_installer
performSelectorOnMainThread:@selector(progressSheetHide:)
withObject:NULL waitUntilDone:YES];
}
- (void) progressSheetShow:(id)object
{
[_window makeKeyAndOrderFront:self]; // sheets act
goofy if the parent is minimized
[_progressSheetBar setDoubleValue:0.0];
[_progressSheetStopButton setEnabled:YES];
[NSApp beginSheet:_progressSheet
modalForWindow:_window
modalDelegate:self
didEndSelector:NULL
contextInfo:NULL];
}
- (void) progressSheetHide:(id)object
{
[NSApp endSheet:_progressSheet returnCode:0];
[_progressSheet orderOut:self];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden