• 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: Need longer highlight w/ NSButton performClick:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need longer highlight w/ NSButton performClick:


  • Subject: Re: Need longer highlight w/ NSButton performClick:
  • From: Glen Simmons <email@hidden>
  • Date: Mon, 28 Mar 2005 14:19:07 -0600

On 28 Mar, 2005, at 2:07 PM, Glen Simmons wrote:

On 28 Mar, 2005, at 12:17 PM, Ricky Sharp wrote:


On Monday, March 28, 2005, at 12:09PM, Glen Simmons <email@hidden> wrote:


I'm calling -performClick: on an NSButton subclass which works fine
except that the highlight doesn't last long enough. I'd like it to be
more obvious to the user which button was "pressed". How can I get it
to highlight for a set length of time, like .1 seconds?

In your NSButton subclass, override performClick: to basically do this:


[[self cell] setHighlighted:YES];
[self display];

NSDate* theDate = [[[NSDate alloc] initWithTimeIntervalSinceNow:myIntervalInSeconds] autorelease];

[NSThread sleepUntilDate:theDate];

[[self cell] setHighlighted:NO];
[self display];



Ricky, Shawn,

thanks for the input. Wouldn't I also need to call [super performClick:] somewhere? Do you think before or after the sleep?


Sorry, should've just tried it instead of being lazy and asking. Upon trying, the above does the highlight, but doesn't perform the action. I removed the last two lines and replaced them with [super performClick:] and the highlight is turned off and the action is performed. So this will do just what I want.


Does anyone see any problem with this? I always feel a little uneasy about sleeping in the main thread, but it should be OK if it's low enough (.1 sec or so), right?

Glen

_______________________________________________
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: Need longer highlight w/ NSButton performClick:
      • From: Ricky Sharp <email@hidden>
    • Re: Need longer highlight w/ NSButton performClick:
      • From: Ondra Cada <email@hidden>
References: 
 >Need longer highlight w/ NSButton performClick: (From: Glen Simmons <email@hidden>)
 >Re: Need longer highlight w/ NSButton performClick: (From: Ricky Sharp <email@hidden>)
 >Re: Need longer highlight w/ NSButton performClick: (From: Glen Simmons <email@hidden>)

  • Prev by Date: Re: NSTableView and memory management problem.
  • Next by Date: Re: Re[2]: NSTableView and memory management problem.
  • Previous by thread: Re: Need longer highlight w/ NSButton performClick:
  • Next by thread: Re: Need longer highlight w/ NSButton performClick:
  • Index(es):
    • Date
    • Thread