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 (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to