Re: [SOLVED!] Progress Sheet on a NSDocument
Re: [SOLVED!] Progress Sheet on a NSDocument
- Subject: Re: [SOLVED!] Progress Sheet on a NSDocument
- From: "Alan Smith" <email@hidden>
- Date: Sun, 25 Mar 2007 11:30:39 -0500
No, I didn't start it from a thread other than the main one unless a
menu item action is called from another thread. Here is my working
code:
- (void)savePanelDidEnd:(NSSavePanel*)panel returnCode:(int)returnCode
contextInfo:(void*)contextInfo
{
if (returnCode == NSOKButton)
{
[self performSelectorOnMainThread:
@selector(threadedSaveMovieToPath:) withObject: [panel filename]
waitUntilDone: NO];
}
}
- (void)threadedSaveMovieToPath:(NSString*)path
{
[NSThread detachNewThreadSelector: @selector(saveMovieToPath:)
toTarget: self withObject: path];
}
- (void)saveMovieToPath:(NSString*)path
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
stopProcess = NO;
[progressPanel beginModalForWindow: [self windowForSheet]
modalDelegate: self didEndSelector: @selector(sheetDidEnd: returnCode:
contextInfo:) contextInfo: nil];
//Heavy processing...
[NSApp endSheet: [progressPanel panel]];
[pool release];
}
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unnecessary, then it
shall evolve."
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden