• 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: my app needs another incoming event after closing modal panel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: my app needs another incoming event after closing modal panel


  • Subject: Re: my app needs another incoming event after closing modal panel
  • From: Graham Cox <email@hidden>
  • Date: Wed, 15 Jul 2009 12:18:20 +1000


On 14/07/2009, at 10:33 PM, Thomas Pesters wrote:

Hi,

I'm having the following problem:

- I'm opening a panel with a progress indicator
- I'm starting a new thread with a background function (via NSThread
detachNewThreadSelector)
- I do NSApp runModalForWindow: for the progress panel
- when the thread is finished, I close the progress panel ("orderOut:self")
and do [NSApp abortModal];


When my app finishes the background thread, the progress window closes as
expected, modal stops and the windows below get focus. But: only after an
event arrives (moving the mouse or hitting a key), the normal procedure of
the app continues (in my case an alert is supposed to open to show some
result of the just finished background processing, which does not open until
an event arrived).


What am I doing wrong?


When your thread updates the progress window, it needs to ensure that this happens on the main thread, so at some point the progress notifications need to call -performSelectorOnMainThread:, etc..

Also, may I ask: if you run the progress window modally, your app is effectively blocked, as far as the user's ability to get work done is concerned. This to my mind means that doing the work in a background thread is of no benefit - you may as well have run that code synchronously. In the few places I do this sort of thing, my progress window is modeless so that the user can do stuff while the background thread runs, and just keep an eye on how it's going with the progress window. Wouldn't that make more sense?

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


References: 
 >my app needs another incoming event after closing modal panel (From: Thomas Pesters <email@hidden>)

  • Prev by Date: Re: Use Cocoa in QL Generator
  • Next by Date: Why this program does not run without nib file?
  • Previous by thread: Re: my app needs another incoming event after closing modal panel
  • Next by thread: How to create programaticlly
  • Index(es):
    • Date
    • Thread