Re: Secondary run loops?
Re: Secondary run loops?
- Subject: Re: Secondary run loops?
- From: Andrei Tchijov <email@hidden>
- Date: Wed, 9 Aug 2006 23:48:56 -0400
calling
[[ NSRunLoop currentLoop ] runUntilDate: [ NSDate
dateWithTimeIntervalSinceNow: 1.0 ]]
in place of WaitNextEvent() might help
On Aug 9, 2006, at 11:28 PM, Mark Dawson wrote:
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
_______________________________________________
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