FlagsChanged while NSMenu is displayed
FlagsChanged while NSMenu is displayed
- Subject: FlagsChanged while NSMenu is displayed
- From: email@hidden
- Date: Sat, 25 Jan 2014 03:01:12 +0900
I wanted to show a hidden menu item in the Window menu when the option key is pressed.
Similar to the way the Finder's Go menu behaves with the user Library menu item.
I was able to use the NSMenu delegate methods to do this by using a CGEventTap creating or re-enabling the tap in menuWillOpen: and disabling the tap in menuDidClose:
This works well and the callback calls a method ( with some void* bridging to the app delegate object ) to set the menu item hidden and enabled states and update the menu.
However, I also tried and failed with NSEvent global and local monitors.
So, I have a few remaining questions.
Do menus receive events before the application itself?
Is there a better way to do this? It feels like using a sledgehammer for a butter knife.
Would this be sandbox compliant at all?
Thanks
JJ
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden