KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to add a menu item into the application's main menu that will be used quite rare. I want it to be hidden by default and show it only when user hold down Option key. How do i do this? It seems that I should handle flagsChanged: , but it is NSResponder 's method and NSMenu does not inherits from NSResponder ? I tried it inside main window controller, and it works when I press Option key before I click on menu. The following use case doe not work: click on menu item (there is no item), press option key — my item should appear, release option key — item should disappear. I've also tried NSEvent's addLocalMonitorForEventsMatchingMask:handler: and addGlobalMonitorForEventsMatchingMask:handler: for NSFlagsChangedMask but when option key pressed while main menu is open neither local or global handlers are not fired. How can I do this?
Tags (comma-separated)
Save Edits
Cancel