Re: Catching a click during a loop
Re: Catching a click during a loop
- Subject: Re: Catching a click during a loop
- From: Mark Williams <email@hidden>
- Date: Sat, 30 Jul 2005 19:42:44 -0700
Ok, well it's not taking the click at all until after the loop finishes.
So I guess I'm wondering what I did wrong in this loop that I cannot
click cancel.
Mark.
On Jul 30, 2005, at 5:17 PM, Mark Williams wrote:
Thanks, I'll do that. I'm not sure what you mean by declaring the
flag as volatile though.
Mark.
On Jul 30, 2005, at 2:31 PM, Cameron Hayne wrote:
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:
40fornextsoft.com
This email sent to 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:
40fornextsoft.com
This email sent to 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