Re: beginSheet, doesn't stop NSThread
Re: beginSheet, doesn't stop NSThread
- Subject: Re: beginSheet, doesn't stop NSThread
- From: Chris Suter <email@hidden>
- Date: Fri, 20 Jul 2007 17:51:34 +1000
On 20/07/2007, at 5:36 PM, Manfred Schwind wrote:
I'm a bit stuck here, any help appreciated. I've got a NSThread
that runs a file copy process, in the process it needs to display
an Alert sheet asking for some user choices.
Most GUI stuff in Cocoa (the Application Kit) can only be used from
the main thread.
But in Cocoa you can easiliy "switch over" to the main thread with
performSelectorOnMainThread:withObject:waitUntilDone: and by
passing YES as the last parameter you can let the calling thread
wait until the method in the main thread has finished.
You will only be able to wait for the main thread to finish if it's
an application modal dialog you're presenting. If you're presenting a
sheet for a document window (see Apple's Human Interface Guidelines
if you're unsure which to use), it won't work and you'll have to use
some other kind of synchronisation mechanism (e.g. NSConditionLock).
- Chris
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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