• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
FlagsChanged while NSMenu is displayed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: FlagsChanged while NSMenu is displayed
      • From: Jens Alfke <email@hidden>
    • Re: FlagsChanged while NSMenu is displayed
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Non-breaking hyphen in UILabel?
  • Next by Date: Re: FlagsChanged while NSMenu is displayed
  • Previous by thread: Re: Non-breaking hyphen in UILabel?
  • Next by thread: Re: FlagsChanged while NSMenu is displayed
  • Index(es):
    • Date
    • Thread