On Mon, Mar 16, 2009 at 1:09 PM, Livio Isaia <lis...@tiscalinet.it> 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 (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 arch...@mail-archive.com

Reply via email to