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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to