Re: Detecting the Option key on selecting a menuitem
Re: Detecting the Option key on selecting a menuitem
- Subject: Re: Detecting the Option key on selecting a menuitem
- From: Prachi Gauriar <email@hidden>
- Date: Tue, 3 May 2005 02:54:58 -0400
On May 2, 2005, at 10:41 PM, Ondra Cada wrote:
Stephen,
On 3.5.2005, at 4:33, Stephen J McIntosh wrote:
Has anyone got an sample code (Objective C) that can show how to
catch a menu item selected with the Option key is held down?
Anyway -- there might be even better way for menus (directly tied up
to their title switching, I kind of recall I've seen somewhere some
documentation of the thing being actually different menu items -- with
different actions or tags or wahtever -- switched just visually, but
perhaps my memory plays tricks on me), but the old mantra of [[NSApp
currentEvent] modifierFlags]&NSAlternateKeyMask should work all right.
In IB, create two menu items: one for the normal menu item (A) and one
for the alternate menu item (B), with B immediately after A. Set A and
B's key equivalents to be the same, but require B's to use the option
modifier. Then, with B selected, click the "Treat as an alternate to
the previous item" checkbox in the Attributes inspector. That should
get your menu items to change titles and behavior by pressing the
option key.
-Prachi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden