Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 4 - Keyboard Enhancements / Keyboard Reference
Data Structures


The Command-Key Mapping Frame

The mapping between keystrokes and commands is defined by keyCommand frames, which are used for the following purposes:

The keyCommand frame contains six slots, as shown here:

keyCommand := {

char: $a, modifiers: kCommandModifier, keyMessage: '_SelectAll, name: "Select All", category: "Editing" showChar: $a };

Slot descriptions

char
The unmodified character of the keypress. Required.
modifiers
The required modifiers. This slot can be absent or nil, in which case no modifiers are required.
This slot can also be used to specify other flags related to the command:
kRepeatable
The command is to be executed on key-repeat events as well as key-down events.
kWorksInAllModals
Applies only to system-wide (root view) commands. When set, the command is available in modal dialogs.
kWorksInAppModals
Applies only to system-wide (root view) commands. When set, the command is available in modal dialogs whose vApplication bit is set.
keyMessage
A symbol. Required. This is the message that is sent when the keyCommand is matched. You must supply a method of this name that takes a single parameter (the current key-view) somewhere in the key-view chain. The method is called when the system matches the key command.
name
A string. The name of the command that appears on menus and the command key popup help slip. If this slot is nil or absent, the key equivalent is not displayed on the popup help slip.
category
A string. The name of the category to which the command belongs on the command key popup help slip. If this slot is absent or nil, but there is a name slot, the command is placed in the "Other" category on the command key popup help slip.
showChar
A character. Optional. If present, this character is shown on popup menus and in the popup help slip instead of the character in the char slot. This is useful for presenting a more user-friendly key combination to the user than the actual combination. For example, you can define the Cmd-/ combination and present it as Cmd-? by defining this slot with the '?' character.
Table 4-13 shows the key codes for special (non-printing) keyboard keys. You can use these values in the char slot of your keyCommand frame.

Table 4-13 Key codes for special keys
ConstantValue
kTabKey$\u0009
kBackspaceKey$\u0008
kReturnKey$\u000D
kEnterKey$\u0003
kEscKey$\u001B
kLeftArrowKey$\u001C
kRightArrowKey$\u001D
kUpArrowKey$\u001E
kDownArrowKey$\u001F
  
kF1Key$\uF721
kF2Key$\uF722
kF3Key$\uF723
kF4Key$\uF724
kF5Key$\uF725
kF6Key$\uF726
kF7Key$\uF727
kF8Key$\uF728
kF9Key$\uF729
kF10Key$\uF72A
kF11Key$\uF72B
kF12Key$\uF72C
kF13Key$\uF72D
kF14Key$\uF72E
kF15Key$\uF72F

Note
The function keys (KF1Key through kF15Key) are only available on the eMate 300 keyboard.
Previous Book Contents Book Index Next

© Apple Computer, Inc.
26 APR 1997



Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help