Pressable Button
Pressable Button
- Subject: Pressable Button
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Tue, 16 Dec 2008 22:02:01 +0700
I am trying to build a pressable button: an on-off button (subclass of
NSButton), which, if pressed for more than 0.3 seconds, displays a
context menu.
My idea was:
Start a non-repeating timer in mouseDown: and schedule it with
NSEventTrackingRunLoopMode.
In mouseUp: invalidate the timer.
And in timerFired: display the context menu.
But: mouseUp: is never called. So: where should I invalidate the timer?
And: if I send: [ NSMenu popUpContextMenu: menu withEvent:
mouseDownEvent forView: self ]
the button gets all messed up: no more drawRect: on mouse up, no
action sent.
Obviously I am doing it all wrong.
Kind regards,
Gerriet.
_______________________________________________
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