Important: The information in this document is obsolete and should not be used for new development.
Virtual Key Codes for Non-ADB Keyboards
The original Macintosh keyboard (for both the 128K and 512K versions) and the Macintosh Plus keyboard produce event records with raw key codes rather than virtual key codes, because there is no key-map resource for them. For domestic versions of these keyboards it is not a problem, because the raw key codes are identical to the virtual key codes expected by the U.S. keyboard-layout resource. The international version of the Macintosh Plus keyboard, however, and the ISO layout of the small Macintosh 512K keyboard, produce raw key codes that cannot be treated as virtual.When a keypress from the international version of the Macintosh Plus keyboard occurs, the interrupt handler calls the
_Key1Trans
hook, which translates the raw key codes to virtual key codes before callingKeyTranslate
. Thus your application normally receives the correct character codes even if an international version of the Macintosh Plus keyboard is attached. However, the raw key code is what is placed in the event record. Therefore, if you need to explicitly convert raw key codes to virtual key codes, you can use the values in Table C-7. Raw key codes are offsets into the table; the byte
at each offset represents the virtual key code for that raw key code. (The keyboard produces raw key codes up to $3F only; key codes above that value are generated by an optional keypad.)The domestic and ISO layouts of the small Macintosh 512K keyboard have keyboard types of 3 and 259, respectively. However, in both cases the low-memory global that specifies current keyboard type (
KbdType
) holds the value 3. The user indicates which keyboard is in use through a control in the Keyboard control panel that appears only on non-ADB systems. The user's selection is kept in theitlcOldKeyboard
field of the system script's international configuration ('itlc'
) resource. You can examine that field if you need to know whether the ISO or domestic layout of the small Macintosh 512K keyboard is in use.