• 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: Knowing mouse pressed time?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Knowing mouse pressed time?


  • Subject: Re: Knowing mouse pressed time?
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 30 Dec 2009 17:09:17 -0600

On Dec 30, 2009, at 3:59 PM, Henry McGilton (Boulevardier) wrote:

> I meant that rather than setting a timer and implementing a callback method and
> remembering to invalidate the timer, and so on and so on, you can do something
> like this (which took less time to implement than the time required to explain it . . . ):
>
> - (void)mouseDown:(NSEvent *)theEvent
> {
> 	NSLog(@"mouseDown");
> 	[self setStartStamp: [theEvent timestamp]];
> }
>
> - (void)mouseUp:(NSEvent *)theEvent
> {
> 	NSLog(@"mouseUp");
> 	NSTimeInterval  endStamp = [theEvent timestamp];
> 	NSLog(@"time difference = %.2f", endStamp - [self startStamp]);
> }
>
> where   startStamp   is an instance variable that records the timestamp on mouse down.
> Then on mouse up, you grab the timestamp of the mouseUp's event and take the difference
> between the two timestamps . .

There is no mouse-up event.  He wants to present a menu if there's been X time since the mouse-down even when _no other events have arrived since then_.  There's no getting around using a timer of some sort.

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Knowing mouse pressed time?
      • From: Andreas Mayer <email@hidden>
    • Re: Knowing mouse pressed time?
      • From: Gustavo Pizano <email@hidden>
References: 
 >Knowing mouse pressed time? (From: Gustavo Pizano <email@hidden>)
 >Re: Knowing mouse pressed time? (From: "email@hidden" <email@hidden>)
 >Re: Knowing mouse pressed time? (From: "Henry McGilton (Boulevardier)" <email@hidden>)
 >Re: Knowing mouse pressed time? (From: Gustavo Pizano <email@hidden>)
 >Re: Knowing mouse pressed time? (From: "Henry McGilton (Boulevardier)" <email@hidden>)

  • Prev by Date: Re: Encrypting Binary Strings
  • Next by Date: Re: AddressBook ABMultiValue -labelAtIndex:
  • Previous by thread: Re: Knowing mouse pressed time?
  • Next by thread: Re: Knowing mouse pressed time?
  • Index(es):
    • Date
    • Thread