About KeyboardsThe Macintosh computer supports over 12 separate physical types of keyboards. Your application needs to be able to handle text input from the domestic and ISO layouts of all Apple keyboards. It also needs to be able to distinguish multiple keyboards and to use the modifier flag that detects the state of the modifier keys (Shift, Caps Lock, Command, Option, and Control) on keyboards.
Table C-1 lists the keyboard types. These type values are used in some of the keyboard resources discussed later in this appendix.
Table C-1 The keyboard types Keyboard
Keyboard 1 Apple Keyboard and Apple Keyboard II (domestic layout) 2 Apple Extended Keyboard and Apple Extended Keyboard II
3 Small Macintosh 512K Keyboard (no keypad; domestic layout) 4 Apple Keyboard (ISO layout) 5 Apple Extended Keyboard II (ISO layout) 6 Apple Macintosh Portable Keyboard (domestic layout) 7 Apple Macintosh Portable Keyboard (ISO layout) 8 Apple Macintosh Keyboard II (domestic layout) 9 Apple Macintosh Keyboard II (ISO layout) 11 Macintosh Plus Keyboard with the built-in keypad 12 Macintosh PowerBook Keyboard (domestic layout) 13 Macintosh PowerBook Keyboard (ISO layout) 259 Small Macintosh 512K Keyboard (no keypad; ISO layout)
Figure C-1 and Figure C-2 show the U.S. layout of the Apple Keyboard II and Apple Extended Keyboard II and the virtual key codes produced by each key. The codes are the values that result after the raw key codes produced by the hardware have been mapped through the key-map resource. See "Key Translation" on page C-8. Other keyboards can produce different virtual key codes; some produce raw key codes only.
The Apple Extended Keyboard may be connected to the Apple Desktop Bus (ADB) of any computer in the Macintosh II or Macintosh SE family. It contains duplicated Shift, Option, and Control keys to the right of the Space bar. Other keyboards have different physical layouts.
Figure C-1 Apple Keyboard II (domestic layout)
Figure C-2 Apple Extended Keyboard II (domestic layout)
Table C-2 shows the keyboard modifier bits in the high byte of the
modifiersfield of an event record (defined by the
EventRecorddata type). The byte consisting of these bits is used to control the selection of tables in the keyboard-layout resource. See "Keyboard-Layout Resource (Type 'KCHR')" beginning on page C-18.
Table C-2 The keyboard modifier bits in an event record Bit Key 7 (Right Control if used) 6 (Right Option if used)  5 (Right Shift if used)  4 Control (Left Control if different from Right Control) 3 Option (Left Option if different from Right Option) 2 Caps Lock 1 Shift (Left Shift if different from Right Shift) 0 Command
 See "Reassigning Right-Hand Key Codes" beginning on page C-14.