• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Catching a click during a loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Catching a click during a loop
      • From: Mark Williams <email@hidden>
References: 
 >Catching a click during a loop (From: Mark Williams <email@hidden>)

  • Prev by Date: Re: Crash when calling custom methods in custom subclass.
  • Next by Date: Re: NSTextField
  • Previous by thread: Catching a click during a loop
  • Next by thread: Re: Catching a click during a loop
  • Index(es):
    • Date
    • Thread