• 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 the Option key on selecting a menuitem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Detecting the Option key on selecting a menuitem (From: Stephen J McIntosh <email@hidden>)
 >Re: Detecting the Option key on selecting a menuitem (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Tiger documentation update
  • Next by Date: ditto in ObjC or C
  • Previous by thread: Re: Detecting the Option key on selecting a menuitem
  • Next by thread: Clarification: Detecting the Option key on selecting a menuitem
  • Index(es):
    • Date
    • Thread