Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: updating UI during long loop using cocoa objective-c



On 3/31/07, Jerry Krinock <email@hidden> wrote:


On 2007 Mar, 31, at 20:45, I. Savant wrote:

Allow me to return some good advice someone gave me a few weeks ago:
Before you delve into multithreading, consider running your window as
a "modal session".  Poorly documented, no sample code, but simple if
you can get it to work.  Start by reading the documentation for:
         -[NSApplication beginModalSessionForWindow:]
It's really weird because the NSModalSession is a struct, but just go
along with it.  Another hint: Use the strangely-named method:
        -runModalSession:
when you want to update your view.



I think, though I haven't tried, a similar effect can be had by sendign the runUntilDate message to the application thread's run loop. If you pass in a date that is a suitable short time from now, say 1/60th of a second, I think that allows the UI to be updated and prevents the spinning wheel o' death. YMMV though: Never tried it; just infered from the documentation. Couldn't find the one that reviewed the cocoa event system though.


-- -Corey O'Connor _______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden
References: 
 >updating UI during long loop using cocoa objective-c (From: <email@hidden>)
 >Re: updating UI during long loop using cocoa objective-c (From: "I. Savant" <email@hidden>)
 >Re: updating UI during long loop using cocoa objective-c (From: Jerry Krinock <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.