Currently I have an IBAction for a NSButton, and the NSButton also has a key equivalent. I would like to know if there is a way inside my IBAction function "strike"
- (IBAction)strike:(id)sender
that can tell me whether this action is triggered by a mouse click on the button or a press of the key equivalent of the button?
get the current event using -currentEvent and using if loop check for mouse click count
if([theEvent clickCount]>=1)
{
mouse clicked;
}
else
{
button pressed;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.