Playing with Scan Codes
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Sprezzatura Ltd | 01 NOV 1990 | 2.021+ | EXPERT | SCAN, CODE, ACTIVE.KEYS, SYS.HELP, DISABLE.KEYS, FAT.FINGER, FUNCTION.KEY, KEYBOARD, B245 |
The issue of keyboard control has not previously been addressed in REVMEDIA so here all of the system routines relating to scan codes are explored. Using these routines it is possible to improve system error messages, access scan codes easily and translate between these, function keys and English with alacrity.
ACTIVE.KEYS
SUBROUTINE - 1 passed parameter.
This is the routine responsible for displaying the "Active Keys" popup when the user presses [Ctrl- F9]. It retrieves the information to display from the SYS.HELP file where it is stored as a record with a key of type KEYS*PROCESS where PROCESS is one of the defined keymaps such as EDIT or WINDOW. To use an existing map just call ACTIVE.KEYS(PROCESS) eg CALL ACTIVE.KEYS("WINDOW"). The routine will add the KEYS*, retrieve the record and display the popup.
To add user defined maps, create a record in SYS.HELP with one field per line of popup. Each field has the structure KEY_NAME : @VM : KEY_DESCRIPTION : @VM : KEYSTROKE. All three values are optional. The 1st is the short name for the key, the 2nd is the description for the key's function. The 3rd entry is the expanded form of the key name enclosed in {}. This enables ACTIVE.KEYS to return this keystoke to the program if the user presses return on a row of the popup. Thus a typical entry might be
Esc 2 Press to exit program 2 {ESC} 2 Or other keys are F9 2 Save the record 2 {F9}
DISABLE.KEYS
SUBROUTINE - 1 passed parameter
This is the routine responsible for allowing the developer to choose which keys to disable in Window. It returns a field mark delimited set of scan codes corresponding to the keys disabled. If the parameter passed is a field mark delimited set of scan codes, these options will be pre-tagged as disabled.
FAT.FINGER
SUBROUTINE - 4 passed parameters
This is the routine responsible for the "B245" message ("The "Alt-P" key is not active in Roam mode"). The first and fourth parameters seem not to be used. The second should be the scan code which is at fault and the third should be the program name or description to be slotted in between "not active" and "Press Ctrl-F9". Note that the system will automatically convert the scan code to its more usual form.
FUNCTION.KEY
FUNCTION - 1 passed parameter
Passed a function key short name (F2, Ctrl-F6 et al) this function returns the scan code.
KEYBOARD
FUNCTION - 1 passed parameter
Passed a scan code (for any key), this function returns the meaningful "English" name for the key. EG passed CHAR(0) : CHAR(99) this function would return "Ctrl-F6".
(Volume 2, Issue 6, Page 4)