On 07 Apr 2015, at 21:49, Dave <d...@looktowindward.com> wrote:
> Given the iOS/Cocoa-Touch code:
> 
> [self addTarget:self action:@selector(buttonTouchUpInsideAction:) 
> forControlEvents:UIControlEventTouchUpInside];
> [self addTarget:self action:@selector(buttonTouchDownAction:) 
> forControlEvents:UIControlEventTouchDownInside];

I presume you mean to react both to mouseDown and mouseUp events? Not touch 
gestures on the trackpad? You'd have to subclass NSButton and override 
NSResponder's mouseDown: and mouseUp: methods. buttons on OS X support neither 
multiple target/action pairs on one object, nor do they let you control when 
they send their action. They will always send it on a mouseUp: with the mouse 
inside the button.

Whatever you do, also keep in mind that full keyboard access and accessibility 
(the latter also on iOS) let you trigger buttons without using the mouse, so if 
you assume your mouseUp: action will always trigger after a mouseDown:, you may 
get a surprise with users who trigger them without the mouse (e.g. by tabbing 
and using the space key, or pressing the return key to trigger a default 
button).

Cheers,
-- Uli
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to