• 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: Fast double click, vs slow one, different actions?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast double click, vs slow one, different actions?


  • Subject: Re: Fast double click, vs slow one, different actions?
  • From: Peter Schart <email@hidden>
  • Date: Tue, 19 Sep 2006 16:47:18 -0500


On Sep 19, 2006, at 4:22 PM, Theodore H. Smith wrote:

How can I make an NSTable, give different actions, with a fast double click vs a slow one? Kind of like iTunes does.

I want it to work much like iTunes actually. Fast one will perform a normal action, and a slow one will edit the name.

No idea how to do it.

I've never tried this myself, so my idea may not even work (and even if it does there may be a better way to do it) but here's what I'd start out with if I was trying to implement such a feature:


You've got setDoubleAction: already, set it to what you want the "fast" double click action to be. For the "slow double click" action, I see at least 2 possibilities.

1. You have an action wired up to single click, in that action you first make note of the time the click occurred and what row+column it's in (or even the exact pixel location of the pointer, if you want movement between clicks to invalidate the "slow double" action). Then compare this against the previously noted time/location and if it's the same cell and within a certain amount of time of the previous click you can consider it a "slow double click" and take the appropriate measures.

2. Similarly, you could just note the location and then set up an NSTimer that will fire after your maximum time between clicks has expired. If and when it fires just release the timer and set it to nil. Then, if another click at the same location is encountered and the timer hasn't yet fired you can then consider it a "slow double click."

In either case, I believe that a "fast" double click will get swallowed by your doubleAction but if the user is slow enough to not trigger a doubleAction and fast enough to be within your threshold it should work.

Naturally, there would be some intricacies I haven't discussed. Perhaps most notably the fact that the speed of a double click is variable as some users may have it set slower than others. This would need to be taken into account or your threshold may be shorter than the system's in which case the doubleAction would always win. Surely there is a way to get the user's setting for a double click and then you can just tack on a second or whatever.

That's my stab. Someone with more experience than I may have a better suggestion...

Hope I've been helpful and not overly-verbose.

-peter schart

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >Fast double click, vs slow one, different actions? (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: Fast double click, vs slow one, different actions?
  • Next by Date: Re: Fast double click, vs slow one, different actions?
  • Previous by thread: Re: Fast double click, vs slow one, different actions?
  • Next by thread: Re: Fast double click, vs slow one, different actions?
  • Index(es):
    • Date
    • Thread