Re: Showing a menu after a delay...?
Re: Showing a menu after a delay...?
- Subject: Re: Showing a menu after a delay...?
- From: Eric Schlegel <email@hidden>
- Date: Mon, 01 Feb 2010 20:18:44 -0800
On Feb 1, 2010, at 2:08 PM, Eric Gorr wrote:
> performSelector:withObject:afterDelay: will only perform the selector after a delay after the mouse button goes up. I had actually tried doing this manually with the code
>
> NSTimer *mouseStillDownTimer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(mouseStillDown:) userInfo:NULL repeats:NO];
> NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop];
>
> [currentRunLoop addTimer:mouseStillDownTimer forMode:NSDefaultRunLoopMode];
>
> when I first noticed the timers (which performSelector:withObject:afterDelay relies upon) don't fire until after the mouse button goes up.
That's probably because you're installing the timer in the default runloop mode. While the mouse is down, AppKit is tracking the mouse using NSEventTrackingRunLoopMode. Try using that mode (or possibly , NSRunLoopCommonModes) instead.
-eric
_______________________________________________
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