Re: Knowing mouse pressed time?
Re: Knowing mouse pressed time?
- Subject: Re: Knowing mouse pressed time?
- From: Gustavo Pizano <email@hidden>
- Date: Wed, 30 Dec 2009 20:43:38 +0100
Henry hi.
You mean with the NEEvent method that returns the timestamp?... I was trying that also, and as far as I understood its the timestamp between the App startup and the event... so I dunno how this might help me... maybe I misunderstood the API doc?
To clarify the original question, what I want to achieve is something similar to 10.6 dock, when you press the mouse on an icon, after a second or so, the menu appears. I dunno if this is what you understood.. I hope its better explained now. :P
Thanks for your reply
G.
On Dec 30, 2009, at 5:44 PM, Henry McGilton (Boulevardier) wrote:
>
> On Dec 30, 2009, at 2:53 AM, email@hidden wrote:
>
>> Simple. Start a timer on mouse down, invalidate it on mouse up.
>> Something like this (written in mail):
>>
>> NSTimer *timer;
>>
>> -(void)mouseDown:(NSEvent*)ev
>> {
>> timer=[[[NSTimer alloc] blah ...] retain];
>> }
>>
>> -(void)mouseUp:(NSEvent*)ev
>> {
>> if ( [timer isValid] ) {
>> [timer invalidate];
>> [timer release];
>> timer = nil;
>> } else {
>> // perform single-click action
>> }
>> }
>>
>> -(void)performHoldAction:(NSTimer*)tmr
>> {
>> // pop up menu
>> }
>
> Not to 'invalidate' your suggestion, but why not simply ask the appropriate
> event objects for their timestamps ? Or did I overlook something in the
> original question ?
>
> Cheers,
> . . . . . . . . Henry
>
>
> =================================================
> iPhone App Development and Developer Education . . .
> Visit www.nonatomic-retain.com
>
> Mac OSX Application Development, Plus a Great Deal More . . .
> Visit www.trilithon.com
>
_______________________________________________
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