As I solved this, I set NSButton to "Push On Push Off" and then used the following code in my event handler:
NSButton *button = [self.superview viewWithTag:event.keyCode];
if (button != nil && button.state == NSOffState) {
[button performClick:event];
[button performSelector:@selector(performClick:) withObject:event afterDelay:0.5];
}
A button will be highlighted here, as if the user clicked on it, and then clicked it again after half a second.
source
share