I'm interested in capturing key presses while a NSMenu
is open. For example, if the menu is open and the user presses "e", or "1" on the keyboa开发者_StackOverflow中文版rd, send a particular message (preferably passing an event object which contains reference to which key was pressed).
I've looked into alternate menus, but I'm under the impression that can only be used to capture the option key.
Currently I'm not using any custom views, just NSStatusBar
(where the menu spawns from) and NSMenu
.
I'm new to Objective-C so my apologies if I'm wording anything incorrectly.
Really appreciate the help!
I assume you are searching for this: Cocoa NSStatusBar Global HotKey
精彩评论