Instance Method

menuHasKeyEquivalent:forEvent:target:action:

Invoked to allow the delegate to return the target and action for a key-down event.

Declaration

- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id  _Nullable *)target action:(SEL  _Nullable *)action;

Parameters

menu

The menu object sending the delegation message.

event

An NSEvent object representing a key-down event.

target

Return by reference the target object for the menu item that corresponds to the event. Specify nil to request the menu's target.

action

Return by reference the action selector for the menu item that corresponds to the event.

Return Value

If there is a valid and enabled menu item that corresponds to this key-down even, return YES after specifying the target and action. Return NO if there are no items with that key equivalent or if the item is disabled.

Discussion

If the delegate doesn’t define this method, the menu is populated to find out if any items have a matching key equivalent.

See Also