• 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
Secondary run loops?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Secondary run loops?


  • Subject: Secondary run loops?
  • From: Mark Dawson <email@hidden>
  • Date: Wed, 09 Aug 2006 20:28:14 -0700

I'm not as famailiar with run loops in Cocoa and how they work.  Here's my problem:

If I have a "start" button and the user presses it, my action gets called.  If I do "stuff" within that call (posting notifications, etc), it's still happens relative to that call, so the UI isn't being updated.

What I would have done in (old, not sure about new) Carbon would be (pseudo code):
  while !done
    do_something();  // the actual work; could be a thread
    while WaitNextEvent() && !quit() && !processDone()
      updateProgressBar();  // UI is active,  stop if user has pressed "stop" button or thread has finished

This would have been called from the "start" event message (i.e., nested WaitNextEvents).

What's the best way to do this in Cocoa?  What I'm really not sure is how to let events happen while I'm in my loop?

Thanks!

mark


 _______________________________________________
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: Secondary run loops?
      • From: Justin Anderson <email@hidden>
    • Re: Secondary run loops?
      • From: Andrei Tchijov <email@hidden>
  • Prev by Date: Re: NSURLConnection Without NSHTTPCookieStorage
  • Next by Date: Re: Secondary run loops?
  • Previous by thread: "Binding selectedObject cannot be bound to ..." while moving from Tiger to Panther
  • Next by thread: Re: Secondary run loops?
  • Index(es):
    • Date
    • Thread