Re: User interruption
Re: User interruption
- Subject: Re: User interruption
- From: "I. Savant" <email@hidden>
- Date: Mon, 16 Mar 2009 13:26:33 -0400
On Mon, Mar 16, 2009 at 1:09 PM, Livio Isaia <email@hidden> wrote:
> I have a program searching data on disk for a long while and would like to
> allow the user to stop the searching in any moment. What is the best and
> easy way to do it?
> (In addition, if the user clicks an another application during the search
> and then again on my application, my application doesn't become active.)
Have you heard of multithreading? If you're targeting Leopard and
above, read about NSOperation / NSOperationQueue. You'll want to do
the searching in a separate thread / operation, which frees the main
runloop (on which your UI depends) to process mouse clicks, update UI
widgets, etc. Clicking the "stop" button would cancel pending
operations.
--
I.S.
_______________________________________________
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