Re: Showing a menu after a delay...?
Re: Showing a menu after a delay...?
- Subject: Re: Showing a menu after a delay...?
- From: "Henry McGilton (Boulevardier)" <email@hidden>
- Date: Mon, 1 Feb 2010 14:43:16 -0800
On Feb 1, 2010, at 2:11 PM, Eric Gorr wrote:
> Strange, I just replied to Richard saying that my selector is not performed until after the mouse button goes up. I can hold the mouse button down for several seconds and not see the selector performed.
>
> Of course, this may actually be due to the fact that my core event loop is based around ReceiveNextEvent rather then a pure Cocoa event loop. Perhaps that is what is interfering....
>
> Might be headed to DTS for this one...
Well, the documentation does say:
This function tries to fetch the next event of a specified type. If no events in the event queue match, this function will run the current event loop until an event that matches arrives, or the timeout expires. Except for timers firing, your application is blocked waiting for events to arrive when inside this function.
Cheers,
. . . . . . . . Henry
>
>
>
>
> On Feb 1, 2010, at 5:05 PM, Gustavo Pizano wrote:
>
>> Eric Hi, What Richar said its what Im actually doing to achieve such a behaviour, using the performSelectorAfterDelay, will be your best shot but what I do is that if the mouse goes up you just call the the NSObject method cancelPreviousPerformRequestsWithTarget. then the selector will not be performed.
>>
>> Hope it helps
>>
>> Gustavo
>>
>> On Feb 1, 2010, at 10:44 PM, Richard Penwell wrote:
>>
>>> An alternative technique would be roughly:
>>>
>>> 1. Detect mouse down, set state down
>>> 2. Call performSelectorAfterDelay 1 second with a test method
>>> 3. If the mouse goes up, set state up
>>> 4. In the test method, test if the state is down...
>>>
>>> On Feb 1, 2010, at 4:42 PM, Eric Gorr wrote:
>>>
>>>> What I am trying to accomplish is displaying a menu (perhaps with NSPopUpButtonCell's performClickWithFrame method) after a user clicks on a sublass of NSButton and holds the left mouse button for >= 1 second.
>>>>
>>>> Is anyone aware of any sample code doing this?
>>>>
>>>> I imagine I will need to customize the mouseDown method of NSButton with a loop that checks to see if the mouse button is still down. However, I am uncertain how to determine this. I have seen NSEvent's pressedMouseButtons method, but it only became available with the 10.6 SDK and I need something that works with 10.5.
>>>>
>>>> I am also thinking that I may be taking the wrong approach, so any suggestions on what approach I should be taking would be appreciated.
>>>>
>>>> Thank you._______________________________________________
>>>>
>>>> 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
>>>
>>> _______________________________________________
>>>
>>> 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
>>
>
> _______________________________________________
>
> 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
=================================================
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