Where I find a list of key equivalent strings on MacOSX

I need to know what NSString values ​​I can use for key equivalents.

I can’t find out what to use for

  • cursor keys
  • delete / backspace
  • function keys
  • numpad elements
+4
source share
2 answers

See Button programming topics : Setting the equivalent of button buttons :

https://developer.apple.com/library/mac/documentation/cocoa/conceptual/Button/Tasks/SettingButtonKeyEquiv.html

For one character:

[button setKeyEquivalent:@"\r"]; 

For a character without printing:

 unichar left = NSLeftArrowFunctionKey; [button setKeyEquivalent:[NSString stringWithCharacters:&left length:1]]; 

Buttons and menu items use the same API for key equivalents.

+2
source

Each of the key equivalent strings is just a character that enters the key. For text editing keys, there are symbolic constants for each character defined in NSText.h and documented in the NSText documentation . Use [NSString stringWithFormat:@"%C", desiredCharacterGoesHere] to convert them to NSStrings for use with objects such as NSMenuItems.

The same goes for the keys on the numeric keypad, which are no different from their cousins ​​on the main keyboard. In the end, we are dealing with characters, and both sets of keys enter the same characters. I do not think there is a way to set the key code menu, but not its key equivalent; you will need to implement this yourself.

Note that “delete” (as opposed to backspace) is called “forward delete” on a Mac, since backspace is usually called delete.

+1
source

All Articles