I've set a custom NSView
to a NSMenuItem
to do my own drawing and rendering. However the 'keyEquivalent' assigned to the NSMenuItem
does not seem to respond. I understand drawing and action handling needs to be self-handled but I can't seem to be able to capture keyEquivalent request no matter what I do. I've tried subclassing NSApplication's sendEvent but that doesn't work since my app is a NSStatusBarItem
(LSUIElement) and the events from the NSEventTrackingRunLoopMode
(when menu is down) do not reach NSApplication's sendEvent.
Then I've tried using:
- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action
This doesn't work either as this is never called even though I've set the main menu's delegate to the controller.
Does anyone have any idea on how to capture 'keyEquivalent' events on NSMenuItems when using a custom view?
Thanks!