• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [SOLVED!] Progress Sheet on a NSDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: [SOLVED!] Progress Sheet on a NSDocument
      • From: Kevin Hoctor <email@hidden>
    • Re: [SOLVED!] Progress Sheet on a NSDocument
      • From: Andreas Mayer <email@hidden>
    • Re: [SOLVED!] Progress Sheet on a NSDocument
      • From: glenn andreas <email@hidden>
References: 
 >Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)
 >Re: Progress Sheet on a NSDocument (From: Ashley Clark <email@hidden>)
 >Re: Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)
 >Re: Progress Sheet on a NSDocument (From: Dominik Pich <email@hidden>)
 >Re: Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)
 >[SOLVED!] Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)
 >Re: [SOLVED!] Progress Sheet on a NSDocument (From: Andreas Mayer <email@hidden>)

  • Prev by Date: Re: [SOLVED!] Progress Sheet on a NSDocument
  • Next by Date: Re: binding bool value??
  • Previous by thread: Re: [SOLVED!] Progress Sheet on a NSDocument
  • Next by thread: Re: [SOLVED!] Progress Sheet on a NSDocument
  • Index(es):
    • Date
    • Thread