Re: Detecting modifier key down when opening a menu?
Re: Detecting modifier key down when opening a menu?
- Subject: Re: Detecting modifier key down when opening a menu?
- From: Laurent Daudelin <email@hidden>
- Date: Tue, 18 May 2010 12:30:36 -0700
On May 18, 2010, at 12:07, Eric Schlegel wrote:
>
> 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
Wow! I was not aware of that! Is that supported on 10.5 too?
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org
Logiciels Nemesys Software email@hidden
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries
_______________________________________________
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