home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1991-08-17 | 3.7 KB | 104 lines |
- DEFINITION MODULE Keyboard;
- (*******************************************************************************
- Name : Keyboard.DEF
- Version : 1.0
- Purpose : Enables access to RAWKEY events via Intuition.
- Author : PGE
- Date Started : 12/MAR/90.
- Date Complete: 18/MAR/90.
- Modified : 25/MAR/90.added further comments
- *******************************************************************************)
-
- FROM ConsoleDevice IMPORT KeyMapPtr;
- FROM Intuition IMPORT IntuiMessagePtr;
-
- CONST
- NullChar = 0C;
- bs = 10C; (* back space *)
- lf = 12C; (* line feed *)
- vt = 13C; (* vertical tab *) (* RETURN key or ENTER key on
- the Amiga *)
- ff = 14C; (* form feed *)
- cr = 15C; (* carriage return *)
- esc = 33C; (* escape *)
- space = 40C;
- asterix = 52C;
- comma = ",";
- minus = 55C; (* - *)
- dot = 56C; (* . *)
- colon = 72C; (* : *)
- underscore= "_";
- vert = 174C; (* | *)
- del = 177C; (* delete *)
- CSI = 233C;
-
- (* KeyID may be one of the following *)
- KUP = 301; (* Arrow keys *)
- KDOWN = 302;
- KRIGHT = 303;
- KLEFT = 304;
- KSUP = 305; (* Shifted arrow keys *)
- KSDOWN = 306;
- KSRIGHT = 307;
- KSLEFT = 308;
- KHELP = 309; (* Help key *)
- KF1 = 331; (* Function keys F1-F10 *)
- KF2 = 332;
- KF3 = 333;
- KF4 = 334;
- KF5 = 335;
- KF6 = 336;
- KF7 = 337;
- KF8 = 338;
- KF9 = 339;
- KF10 = 340;
- KSF1 = 341; (* Shifted function keys F1-F10 *)
- KSF2 = 342;
- KSF3 = 343;
- KSF4 = 344;
- KSF5 = 345;
- KSF6 = 346;
- KSF7 = 347;
- KSF8 = 348;
- KSF9 = 349;
- KSF10 = 350;
-
- PROCEDURE OpenKey() : INTEGER;
- (* Before reading RAWKEYs from Intuition we have to do some housekeeping.
- This procedure gets a pointer to the Console Device by opening a
- Console Device without attaching it to any window. Its purpose is to
- make the Console Device function RawKeyConvert available.
- The procedure returns 0 if it succeeds, -1 if it failed. *)
-
- PROCEDURE CloseKey;
- (* After doing all our key reading we have to do some final housekeeping.
- This procedure closes the Console Device opened by RawOpen.
- If the Console Device was not successfully opened RawClose will
- return without doing anything. *)
-
- PROCEDURE ReadKey(VAR KeyMessage : IntuiMessagePtr; (* in *)
- VAR KeyID : INTEGER; (* out *)
- VAR KeyMap : KeyMapPtr (* in *) ) : INTEGER;
- (* This routine will return the key that was pressed on the keyboard
- taking into account so called deadkeys and the key map being used, such
- as a German keyboard.
-
- Pass it KeyMessage - obtained from a GetMsg
- KeyID - not passed anything
- KeyMap - when set to NULL the routine will do its
- translation on the default key map. (The routine
- has not been tested for non NULL values.)
- When it has returned
- KeyMessage - not used
- KeyID - only used when the function procedure is 0.
- See constant definitions for values.
- KeyMap - not used
- function procedure - 0 A special key was pressed, so look
- at KeyID for its value
- -1 routine has failed
- -2 either a key up message or it was
- not a raw key
- 1,2.. ASCII character *)
-
- END Keyboard.
-