On Tue, Jun 10, 2008 at 3:17 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > Thanks for the suggestions - basically I have to run my loop on a thread, > seems to be what you're both saying. > > In this case I can do that... though out of curiosity I wonder if there is a > way to do this "cooperatively" on the main thread without having to break up > the loop doing the actual work. For example, in Carbon one can run the event > loop for a short period or just for one event on each cycle of the loop - > and this code can live in the progress dialog controller, so it works > transparently with respect to the loop that drives the progress indicator. > I'm not sure that approach is considered "good" in this day and age though I > used it a lot on Mac OS 6/7/8/9. Just wondered if such an approach is > feasible in Cocoa.
Take a look at -[NSApplication beginModalSessionForWindow:] and the friends described in the docs for that method. This lets you start a modal window, run it at intervals to keep events processing, then close it when done. Of course this requires putting your progress bar in a modal window, but if you're not going to allow the rest of the program to run then this is a good idea anyway. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]