• 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
Re: Detecting modifier key down when opening a menu?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting modifier key down when opening a menu?


  • Subject: Re: Detecting modifier key down when opening a menu?
  • From: Eric Schlegel <email@hidden>
  • Date: Tue, 18 May 2010 12:07:29 -0700

On May 18, 2010, at 12:05 PM, Laurent Daudelin wrote:

> Well, I'd like to track the option key down when a menu is opened so that I can change one of the menu item title dynamically.

I was hoping you'd say that. :) NSMenuItem already has built-in support for this. What you need to do is create two separate menu items and mark them as being alternates of each other (this can be done in IB or with -[NSMenuItem setAlternate:]). One menu item's modifiers should include the option key and the other should not. The menu system will then automatically display the correct menu item depending on whether the user is pressing the option key.

-eric

_______________________________________________

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: Detecting modifier key down when opening a menu?
      • From: Laurent Daudelin <email@hidden>
References: 
 >Detecting modifier key down when opening a menu? (From: Laurent Daudelin <email@hidden>)
 >Re: Detecting modifier key down when opening a menu? (From: Nick Zitzmann <email@hidden>)
 >Re: Detecting modifier key down when opening a menu? (From: Laurent Daudelin <email@hidden>)
 >Re: Detecting modifier key down when opening a menu? (From: Eric Schlegel <email@hidden>)
 >Re: Detecting modifier key down when opening a menu? (From: Laurent Daudelin <email@hidden>)

  • Prev by Date: Re: Detecting modifier key down when opening a menu?
  • Next by Date: Re: Detecting modifier key down when opening a menu?
  • Previous by thread: Re: Detecting modifier key down when opening a menu?
  • Next by thread: Re: Detecting modifier key down when opening a menu?
  • Index(es):
    • Date
    • Thread