progress bar on sheet
progress bar on sheet
- Subject: progress bar on sheet
- From: Chuck Soper <email@hidden>
- Date: Sun, 10 Apr 2005 12:45:23 -0700
Hello,
I'm trying to display a custom sheet with Yes/No buttons and a
indeterminate progress indicator. When the user clicks Yes I need to
start animating the indicator and start a time consuming task. When
the task finishes I'd like to display an NSRunAlertPanel then make
the sheet go away. All of this works great without the progress
indicator.
I confirmed that the indicator is connecting properly with this line:
NSLog(@"maxValue = %d", (int) [doTaskProgress maxValue]);
Also, I confirmed that the NSProgressIndicator instance in IB is indeterminate.
My source is below. Does anyone know how I can get this working? I
think that the fact that the sheet is modal is preventing the
progress bar from updating.
Chuck
// from interface
IBOutlet NSPanel * doTaskSheet;
IBOutlet NSProgressIndicator *doTaskProgress;
// from implementation
- (IBAction)doTaskYes:(id)sender;
{
doingTask = TRUE;
[NSApp endSheet:doTaskSheet];
}
- (IBAction)doTaskNo:(id)sender;
{
[NSApp endSheet:doTaskSheet];
}
- (void)askToDoTaskSheetDidEnd:(NSWindow *)sheet
returnCode: (int)returnCode
contextInfo: (void *)contextInfo
{
if (doingTask) {
[doTaskProgress displayIfNeeded];
[doTaskProgress startAnimation:nil];
//do time consuming task then display alert then remove sheet
[self doTimeConsumingTask];
NSRunAlertPanel(statusString, resultString, @"OK", nil, nil);
[doTaskProgress stopAnimation:nil];
}
doingTask = FALSE;
[sheet orderOut:self];
}
//display the sheet and ask user what to do
- (void)askToDoTaskSheet
{
doingTask = FALSE;
[NSApp beginSheet: doTaskSheet
modalForWindow: mainWindow
modalDelegate: self
didEndSelector:
@selector(askToDoTaskSheetDidEnd:returnCode:contextInfo:)
contextInfo: nil];
}
_______________________________________________
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