• 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: How to use the option key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use the option key


  • Subject: Re: How to use the option key
  • From: Gil Dawson <email@hidden>
  • Date: Tue, 06 May 2014 13:29:58 -0700

Thanks!  

Now that I've found NSMenuItem's setKeyEquivalentModifierMask:, I think I'm on my way.  I sure appreciate your help.

Yay, Cocoa!

--Gil

On May 6, 2014, at 1:11 PM, Lee Ann Rucker wrote:

Not just option key - any modifier will work, and you can have more than one alternate to a given menu item so long as it uses the same key equivalent - we've got one set of power-user features with 4 variations, counting the unmodified one.


On May 6, 2014, at 1:07 PM, Avery Pierce wrote:

Hi Gil,

In Xcode 4.0+ (maybe Xcode 3.X too, I'm not sure), Interface Builder provides a checkbox for menu items called "alternate". If checked, that menu item will only be visible when the option key is pressed, replacing the menu item with the same key equivalent (minus the option modifier, of course). You can also do it programmatically using NSMenuItem's -[setAlternate:] method.

Here's some relevant documentation:

https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/nsmenuitem_class/reference/reference.html#//apple_ref/occ/instm/NSMenuItem/setAlternate:


On Tue, May 6, 2014 at 2:53 PM, Gil Dawson <email@hidden> wrote:
Perhaps this is not the correct list, so maybe someone can direct me to an appropriate list for my question.

I have made, using XCode 3.2.5 and the invaluable help of Shane Stanley's AppleScriptOBJC Explored 4.0.0.pdf, a rather simple application which consists of buttons and labels.  Each button is connected to an AppleScript handler which sends commands to QuickTime and TextWrangler to edit captions.  Each button also has a key equivalent, so the job of matching the dialog to the transcript can be done mostly by touching buttons on the keyboard.  

It all works very well.  Now, I wish to add the option key.  I have noticed that some applications modify labels and menu items when I press the option key.  I would like to do that with my simple app.

For example, I have a button named "Nudge timecode", with the key "N" equivalent, and the nearby label "-250ms".  When I press the option key, I would like my handler to change the label to "+250ms".

My question is: How does Cocoa (or Interface Builder) make available the information that I have pressed the option key?  

I have scanned the Cocoa documentation associated with XCode, but I'm evidently not using the right search terms.

I would appreciate your suggestion as to where to go look for the answer.

--Gil

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How to use the option key (From: Gil Dawson <email@hidden>)
 >Re: How to use the option key (From: Avery Pierce <email@hidden>)

  • Prev by Date: Re: How to use the option key
  • Next by Date: Re: Building a framework within an app's project
  • Previous by thread: Re: How to use the option key
  • Next by thread: Can't find the damn executable
  • Index(es):
    • Date
    • Thread