• 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: Kevin Hoctor <email@hidden>
  • Date: Mon, 26 Mar 2007 12:13:51 -0500

On Mar 25, 2007, at 11:30 AM, Alan Smith wrote:

No, I didn't start it from a thread other than the main one unless a
menu item action is called from another thread.

Alan,

I had my program using a threaded scenario just like you are doing, but I found that I didn't want the user to do anything in my program until my import was done anyway so with the help of this group, I changed my code to stay in the same thread:


- (IBAction)importQIF:(id)sender
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
NSArray *fileTypes = [NSArray arrayWithObject:@"qif"];
[panel beginSheetForDirectory:nil file:nil types:fileTypes modalForWindow:[self windowForSheet] modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
}


- (void)openPanelDidEnd:(NSOpenPanel *)openPanel returnCode:(int) returnCode contextInfo:(void *)contextInfo
{
[openPanel close];
if (returnCode != NSOKButton) return;

[NSApp beginSheet:progressPanel modalForWindow:[self windowForSheet] modalDelegate:self didEndSelector:nil contextInfo:NULL];
NSModalSession modalSession = [NSApp beginModalSessionForWindow:progressPanel];


[self importQIFUsingFile:[openPanel filename] inModalSession:modalSession];

[NSApp endModalSession:modalSession];
[NSApp endSheet:progressPanel];
[progressPanel close];
}


The NSModalSession removed some quirky threading issues that popped up every nth run of this process. You may not have any problems, but if you do this is an alternative.

Peace,

Kevin Hoctor
email@hidden
No Thirst Software LLC
http://nothirst.com


_______________________________________________

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: "Alan Smith" <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>)
 >Re: [SOLVED!] Progress Sheet on a NSDocument (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: How to get key events correctly
  • Next by Date: Core Data Document App: perform an action after the data is loaded
  • Previous by thread: Re: [SOLVED!] Progress Sheet on a NSDocument
  • Next by thread: Re: [SOLVED!] Progress Sheet on a NSDocument
  • Index(es):
    • Date
    • Thread