• 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: delay function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delay function


  • Subject: Re: delay function
  • From: Thomas Davie <email@hidden>
  • Date: Wed, 8 Dec 2004 03:18:21 +0000



On 8 Dec 2004, at 02:43, Ricky Sharp wrote:


On Dec 7, 2004, at 8:05 PM, Gregory Weston wrote:

On Dec 7, 2004, at 8:47 PM, Ricky Sharp wrote:

A couple of people responded with suggestions of how to do this. I'm curious why, though, along with a caution that it's almost certainly something you don't want to be doing in your main thread.

I currently employ the use of NSThread's sleepUntilDate: in a performClick: override in my custom NSControl. I basically highlight the control, delay, then unhighlight it.

Things like that are why I try to remember to use phrases like "almost certainly." Your button highlight would be, what, about 1/8 second? (I seem to remember Apple's old sample code recommended 8 ticks.)

I current have it set to 50 ms which would be just over 6 ticks. I have yet to fine-tune this. At 8-ticks it seems a bit too high when comparing it to what the built-in widgets do (e.g. NSButton).

A quick note - you're much better off using an NSTimer to fire an event when you need to unhighlight your control – that way only the threads that depend on that control block and the rest of your computation continues – much better for multitasking.


Bob

--
What is the internet?
It's the largest equivalence class in the reflexive transitive symmetric closure of the relationship "can be reached by an IP packet from". -- Seth Breidbart


_______________________________________________
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: delay function
      • From: Ricky Sharp <email@hidden>
References: 
 >Re: delay function (From: Gregory Weston <email@hidden>)
 >Re: delay function (From: Ricky Sharp <email@hidden>)
 >Re: delay function (From: Gregory Weston <email@hidden>)
 >Re: delay function (From: Ricky Sharp <email@hidden>)

  • Prev by Date: Object-C question #1
  • Next by Date: Re: delay function
  • Previous by thread: Re: delay function
  • Next by thread: Re: delay function
  • Index(es):
    • Date
    • Thread