Re: beginSheet, doesn't stop NSThread
Re: beginSheet, doesn't stop NSThread
- Subject: Re: beginSheet, doesn't stop NSThread
- From: Manfred Schwind <email@hidden>
- Date: Fri, 20 Jul 2007 09:36:45 +0200
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.
So just switch over to your main thread, let it show the dialog and
after it's done your separate thread will continue. You may have to
pass the return code of the alert from the main thread somehow to the
thread, but in this case this can be done very easy with a volatile
instance variable or something like that.
Regards,
Mani
--
http://www.mani.de
iVolume - Loudness adjustment for iTunes.
LittleSecrets - The encrypted notepad.
_______________________________________________
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