FROM : Chuck Soper
DATE : Sun Apr 10 21:45:23 2005
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];
}
DATE : Sun Apr 10 21:45:23 2005
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];
}
| Related mails | Author | Date |
|---|---|---|
| Chuck Soper | Apr 10, 21:45 | |
| Joannou Ng | Apr 10, 22:34 | |
| Shawn Erickson | Apr 10, 22:48 | |
| Chuck Soper | Apr 10, 23:05 | |
| Hamish Allan | Apr 11, 00:25 | |
| Chuck Soper | Apr 11, 02:09 |






Cocoa mail archive

