Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 2 - Event Manager / Event Manager Reference
Event Manager Routines / Reading the Keyboard


GetKeys

You can use the GetKeys procedure to obtain the current state of the keyboard.

PROCEDURE GetKeys (VAR theKeys: KeyMap);
theKeys
Returns the current state of the keyboard, including the keypad, if any. The GetKeys procedure returns this information using the KeyMap data type.
TYPE KeyMap = PACKED ARRAY[0..127] OF Boolean;
Each key on the keyboard or keypad corresponds to an element in the KeyMap array. The index for a particular key is the same as the key's virtual key code minus 1. For example, the key with virtual key code 38 (the "J" key on the Apple Keyboard II) can be accessed as KeyMap[37] in the returned array. A KeyMap element is TRUE if the corresponding key is down and FALSE if it isn't. The maximum number of keys that can be down simultaneously is two character keys plus any combination of the five modifier keys.
DESCRIPTION
You can use the GetKeys procedure to determine the current state of the keyboard at any time. For example, you can determine whether one of the modifier keys is down by itself or in combination with another key using the GetKeys procedure.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996