Re: Catching a click during a loop
Re: Catching a click during a loop
- Subject: Re: Catching a click during a loop
- From: Cameron Hayne <email@hidden>
- Date: Sat, 30 Jul 2005 17:31:22 -0400
On 30-Jul-05, at 4:56 PM, Mark Williams wrote:
I have a program with a rather lengthy process, and I would like to
be able to click cancel and have the operation canceled. This
process is preformed within a while loop. I have tried running it
in a new thread, I have tried the runUntilDate and neither seems to
allow my cancel button to be clicked (You click and nothing happens.)
Try adding an NSLog statement to the action for the Cancel button.
That will tell you if and when it is getting called. If it is being
called as soon as you click it, then the problem is merely that your
code is not correctly stopping the thread that is doing the lengthy
process. Usually you set a flag and check that flag each time through
the loop in the calculation thread. You should declare the flag
variable as 'volatile' to let the compiler know that it will change
due to an external cause.
--
Cameron Hayne
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden