• 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: run loop problem (i think)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: run loop problem (i think)


  • Subject: Re: run loop problem (i think)
  • From: Bob Ippolito <email@hidden>
  • Date: Thu, 12 May 2005 20:17:11 -0400


On May 11, 2005, at 6:29 PM, Ken Victor wrote:





given the following (summary)in my main thread:

[NSThread detachNewThreadSelector: @selector(doSteps:)
        toTarget: self
        withObject: nil];
[NSApp runModalForWindow: [controller window]];

and

- (void) doSteps: (id) unused {
    NSAutoreleasePool* arp = [[NSAutoreleasePool alloc] init];
    ...
    [NSApp performSelectorOnMainThread: @selector(stopModal)
            withObject: nil
            waitUntilDone: NO];
    [arp release];
    }

ie, i start a thread and then run a modal window. the last thing my thread does before returning is to call NSApp stopModal (and then releases its aur release pool).

the problem is that my code following the call to runModalForWindow doesn't execute until i click the mouse or type a key on the keyboard.

(note that i've tried calling stopModal directly in my thread as opposed to via performSelectorOnMainThread and it doesn't solve the problem. i've also unsuccessfully tried pass YES as the waitUntilDone argument.)

can anyone give me any ideas as to what is causing this behavior, or more importantly how i can avoid it?





It might be running in a different mode (probably NSModalPanelRunLoopMode) when you have a modal run loop up, try using performSelectorOnMainThread:withObject:waitUntilDone:modes: instead and specify [NSArray arrayWithObjects: NSModalPanelRunLoopMode, NSDefaultRunLoopMode, nil] for the modes and see if that helps.


-bob





_______________________________________________
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


  • Follow-Ups:
    • Re: run loop problem (i think)
      • From: "Ken Victor" <email@hidden>
References: 
 >run loop problem (i think) (From: Ken Victor <email@hidden>)

  • Prev by Date: Re: [OT] How does one report bugs to Apple about their applications?
  • Next by Date: Re: CGShading & Printing conflicts
  • Previous by thread: run loop problem (i think)
  • Next by thread: Re: run loop problem (i think)
  • Index(es):
    • Date
    • Thread