indeterminate progress bar animation problem
indeterminate progress bar animation problem
- Subject: indeterminate progress bar animation problem
- From: Ivan Kourtev <email@hidden>
- Date: Sun, 17 Apr 2005 20:43:39 -0400
Hi,
I have an app with a single window that needs to save a file
immediately after the user requests so. I want to display a sheet with
the indeterminate progress indicator in it because sometimes the file
can be quite large and it can take a while. I want the "Please wait
while saving..." sheet with the barber pole style progress bar to show
immediately after the save panel sheet.
So I have the app's only window and its controller (which is also the
window's delegate) and I run an NSSavePanel from within saveDocumentAs:
of the controller:
[savePanel beginSheetForDirectory:NSHomeDirectory() file:_saveFileName
modalForWindow:_window modalDelegate:self
didEndSelector:@selector(singleSaveFileSheetDidEnd:returnCode:
contextInfo:)
contextInfo:nil];
Then, within singleSaveFileSheetDidEnd:returnCode:contextInfo: I did
this:
- (void)singleSaveFileSheetDidEnd:(NSSavePanel*)saveSheet
returnCode:(int)returnCode
contextInfo:(void*)contextInfo
{
...
[saveSheet orderOut:self];
[NSApp beginSheet:_saveFileProgressSheet
modalForWindow:_window
modalDelegate:self
didEndSelector:@selector(saveProgressSheetDidEnd:returnCode:
contextInfo:)
contextInfo:nil];
[_saveProgressIndicator setUsesThreadedAnimation:YES];
[_saveProgressIndicator startAnimation:self];
...
}
I was only able to get the barber pole to show progress if I kept the
setUsesThreadedAnimation line above. If I changed the barber pole to
the spinning indicator, then it worked without requiring
setUsesThreadedAnimation.
What's going on or is this expected behavior (not what I would think
based on NSProgressIndicator's documentation)? Apple's documentation
suggests that using setUsesThreadedAnimation:YES may slow down the app
so I figured there has to be a way to animate the barber pole while
setUsesThreadedAnimation:NO.
Also, does this code above appear to be the correct to implement the
required behavior (save panel sheet, followed immediately by a "Please
wait while saving..." sheet with the spinning barber pole).
Thanks for any suggestions.
--
ivan
_______________________________________________
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