All ABL keys have both a code and a label. The key code is an ABL internal identifier for the key. ABL stores all key codes in 16-bit words. The structure of a key code is as follows:

  • Bits 0–8 — Unique code assigned to the key
  • Bit 9 — The SHIFT key modifier (512)
  • Bit 10 — The ALT or ESC key modifier (1024)
  • Bit 11 — The CTRL key modifier (2048)
  • Bits 12–15 — Reserved bits

This structure allows the AVM to respond to a wide variety of key combinations. For example, you can write a trigger that fires when the user presses CTRL+SHIFT+ALT+F1. The following figure shows how ABL generates key codes when different keys are pressed.

Figure 1. Key codes


ABL uses this scheme wherever possible. However, some keys are assigned key codes that do not fit into this scheme. The following rules determine what key codes are outside of this scheme:

  • If you press CTRL plus an alphabetic character or the (@, \, ], ^, or _ special characters), the AVM turns the CTRL key modifier off and maps to the appropriate character code. For example, CTRL+A is mapped to keycode 1, which accords with the ASCII standard (and therefore most 7–bit character code pages).
  • If you press SHIFT plus a code page character, the AVM turns off the SHIFT key modifier and maps to the appropriate character code. For example, SHIFT+A is equivalent to A, and A is mapped to keycode 65, which accords with the ASCII standard (and therefore most 7–bit character code pages). Also, many code page characters (for example, the comma) do not have uppercase equivalents; therefore, the SHIFT key modifier is turned off.
  • If you press ALT plus an alphabetic character, the AVM maps to the uppercase alphabetic characters. For example, ALT+A and ALT+a are both mapped to keycode 1089. The keycode 1089 corresponds to the keycode 65 (A) with the ALT key modifier turned on (65 + 1024 = 1089).

ABL provides more than one key label for certain key codes. The key labels in the following table are the preferred labels, but you can also use the labels in the "Alternate key codes and key labels" table.

Table 1. Preferred key codes and key labels
Key code Key label
0 CTRL+@
1 through 7 CTRL+A through CTRL+G
8 BACKSPACE
9 TAB
10 through 12 CTRL+J through CTRL+L
13 ENTER (Windows)

RETURN (UNIX)

14 through 26 CTRL+N through CTRL+Z
27 ESC
28 CTRL+\
29 CTRL+]
30 CTRL+^
31 CTRL+_
32 through 126 Corresponding character
127 DEL
128 through 255 Corresponding extended character
300 through 399 F0 through F99
400 through 499 PF0 through PF99
501 CURSOR–UP
502 CURSOR–DOWN
503 CURSOR–RIGHT
504 CURSOR–LEFT
505 HOME
506 END
507 PAGE–UP
508 PAGE–DOWN
509 BACK–TAB
510 INS
511 HELP–KEY
512 DELETE
513 EXECUTE
514 PAGE
515 FIND
516 INS–LINE
517 DEL–LINE
518 LINE–ERASE
519 PAGE–ERASE
520 SHIFT+BACKSPACE
521 SHIFT+TAB
522 EXIT
535 ERASE
536 WHITE
537 BLUE
538 RED
539 RESET
541 CTRL+BREAK
551 through 560 U1 through U10
609 MOUSE–SELECT–UP
610 MOUSE–MOVE–UP
611 MOUSE–MENU–UP
612 MOUSE–EXTEND–UP
617 MOUSE–SELECT–DOWN
618 MOUSE–MOVE–DOWN
619 MOUSE–MENU–DOWN
620 MOUSE–EXTEND–DOWN
625 MOUSE–SELECT–CLICK
626 MOUSE–MOVE–CLICK
627 MOUSE–MENU–CLICK
628 MOUSE–EXTEND–CLICK
640 MOUSE–MOVE
649 MOUSE–SELECT–DBLCLICK
650 MOUSE–MOVE–DBLCLICK
651 MOUSE–MENU–DBLCLICK
652 MOUSE–EXTEND–DBLCLICK
812 through 911 SHIFT+F0 through SHIFT+F99
912 through 1011 SHIFT+ PF0 through SHIFT+PF99
1013 SHIFT+CURSOR–UP
1014 SHIFT+CURSOR–DOWN
1015 SHIFT+CURSOR–RIGHT
1016 SHIFT+CURSOR–LEFT
1017 SHIFT+HOME
1018 SHIFT+END
1019 SHIFT+PAGE–UP
1020 SHIFT+PAGE–DOWN
1021 SHIFT+BACK–TAB
1022 SHIFT+INS
1023 SHIFT+HELP–KEY
1024 ALT+CTRL+@
1025 through 1031 ALT+CTRL+A through ALT+CTRL+G
1032 ALT+BACKSPACE
1033 ALT+TAB
1034 through 1036 ALT+CTRL+J through ALT+CTRL+L
1037 ALT+RETURN
1038 through 1050 ALT+CTRL+N through ALT+CTRL+Z
1051 ALT+ESC
1052 ALT+CTRL+\
1053 ALT+CTRL+]
1054 ALT+CTRL+^
1055 ALT+CTRL+_
1057 through 1150 ALT+ corresponding character
1151 ALT+DEL
1152 through 1279 ALT+ corresponding extended character
1324 through 1423 ALT+F0 through ALT+F99
1424 through 1523 ALT+PF0 through ALT+PF99
1525 ALT+CURSOR–UP
1526 ALT+CURSOR–DOWN
1527 ALT+CURSOR–RIGHT
1528 ALT+CURSOR–LEFT
1529 ALT+HOME
1530 ALT+END
1531 ALT+PAGE–UP
1532 ALT+PAGE–DOWN
1533 ALT+BACK–TAB
1534 ALT+INS
1535 ALT+HELP–KEY
1536 ALT+DELETE
1537 ALT+EXECUTE
1538 ALT+PAGE
1539 ALT+FIND
1540 ALT+INS–LINE
1541 ALT+DEL–LINE
1542 ALT+LINE–ERASE
1543 ALT+PAGE–ERASE
1544 ALT+SHIFT+BACKSPACE
1545 ALT+SHIFT+TAB
1546 ALT+EXIT
1549 through 1558 ALT+U1 through ALT+U10
1559 ALT+ERASE
1560 ALT+WHITE
1561 ALT+BLUE
1562 ALT+RED
1563 ALT+RESET
1565 ALT+ctrl+BREAK
1575 through 1584 ALT+U1 through ALT+U10
1663 SHIFT+ALT+DEL
1664 through 1791 SHIFT+ALT+ corresponding extended character
1836 through 1935 SHIFT+ALT+F0 through SHIFT+ALT+F99
1936 through 2035 SHIFT+ALT+PF0 through SHIFT+ALT+PF99
2037 SHIFT+ALT+CURSOR–UP
2038 SHIFT+ALT+CURSOR–DOWN
2039 SHIFT+ALT+CURSOR–RIGHT
2040 SHIFT+ALT+CURSOR–LEFT
2041 SHIFT+ALT+HOME
2042 SHIFT+ALT+END
2043 SHIFT+ALT+PAGE–UP
2044 SHIFT+ALT+PAGE–DOWN
2045 SHIFT+ALT+BACK–TAB
2046 SHIFT+ALT+INS
2047 SHIFT+ALT+HELP–KEY
2056 CTRL+BACKSPACE
2057 CTRL+TAB
2075 CTRL+ESC
2080 through 2111 CTRL+ corresponding character
2171 through 2174 CTRL+ corresponding character
2175 CTRL+DEL
2209 through 2303 CTRL+ corresponding extended character
2348 through 2447 CTRL+F0 through CTRL+F99
2448 through 2547 CTRL+PF0 through CTRL+PF99
2549 CTRL+CURSOR–UP
2550 CTRL+CURSOR–DOWN
2551 CTRL+CURSOR–RIGHT
2552 CTRL+CURSOR–LEFT
2553 CTRL+HOME
2554 CTRL+END
2555 CTRL+PAGE–UP
2556 CTRL+PAGE–DOWN
2557 CTRL+BACK–TAB
2558 CTRL+INS
2559 CTRL+HELP–KEY
2560 CTRL+DELETE
2561 CTRL+EXECUTE
2562 CTRL+PAGE
2563 CTRL+FIND
2564 CTRL+INS–LINE
2565 CTRL+DEL–LINE
2566 CTRL+LINE–ERASE
2567 CTRL+PAGE–ERASE
2568 CTRL+SHIFT+BACKSPACE
2569 CTRL+SHIFT+TAB
2570 CTRL+EXIT
2573 CTRL+SHIFT+RETURN
2583 CTRL+ERASE
2584 CTRL+WHITE
2585 CTRL+BLUE
2586 CTRL+RED
2587 CTRL+RESET
2559 through 2608 CTRL+U1 through CTRL+U10
2860 through 2859 CTRL+SHIFT+F0 through CTRL+SHIFT+F99
2960 through 3059 CTRL+SHIFT+PF0 through CTRL+SHIFT+PF99
3061 CTRL+SHIFT+CURSOR–UP
3062 CTRL+SHIFT+CURSOR–DOWN
3063 CTRL+SHIFT+CURSOR–RIGHT
3064 CTRL+SHIFT+CURSOR–LEFT
3065 CTRL+SHIFT+HOME
3066 CTRL+SHIFT+END
3067 CTRL+SHIFT+PAGE–UP
3068 CTRL+SHIFT+PAGE–DOWN
3069 CTRL+SHIFT+BACK–TAB
3070 CTRL+SHIFT+INS
3071 CTRL+SHIFT+HELP–KEY
3104 through 3135 CTRL+ALT+ corresponding character
3163 CTRL+ALT+[
3164 CTRL+ALT+\
3165 CTRL+ALT+]
3166 CTRL+ALT+^
3167 CTRL+ALT+_
3168 CTRL+ALT+‘
3195 through 3198 CTRL+ALT+ corresponding character
3199 CTRL+ALT+DEL
3233 through 3327 CTRL+ALT+ corresponding extended character
3372 through 3471 CTRL+ALT+F0 through CTRL+ALT+F10
3472 through 3571 CTRL+ALT+PF0 through CTRL+ALT+PF99
3573 CTRL+ALT+CURSOR–UP
3574 CTRL+ALT+CURSOR–DOWN
3575 CTRL+ALT+CURSOR–RIGHT
3576 CTRL+ALT+CURSOR–LEFT
3577 CTRL+ALT+HOME
3578 CTRL+ALT+END
3579 CTRL+ALT+PAGE–UP
3580 CTRL+ALT+PAGE–DOWN
3581 CTRL+ALT+BACK–TAB
3582 CTRL+ALT+INS
3583 CTRL+ALT+HELP–KEY
3585 CTRL+ALT+EXECUTE
3586 CTRL+ALT+PAGE
3587 CTRL+ALT+FIND
3588 CTRL+ALT+INS–LINE
3589 CTRL+ALT+DEL–LINE
3590 CTRL+ALT+LINE–ERASE
3591 CTRL+ALT+PAGE–ERASE
3592 CTRL+SHIFT+ALT+BACKSPACE
3593 CTRL+SHIFT+ALT+TAB
3594 CTRL+ALT+EXIT
3597 CTRL+SHIFT+ALT+RETURN
3607 CTRL+ALT+ERASE
3608 CTRL+ALT+WHITE
3609 CTRL+ALT+BLUE
3610 CTRL+ALT+RED
3611 CTRL+ALT+RESET
3623 through 3632 CTRL+ALT+U1 through CTRL+ALT+U10
3884 through 3983 CTRL+SHIFT+ALT+F0 through CTRL+SHIFT+ALT+F99
3994 through 4083 CTRL+SHIFT+ALT+PF0 through CTRL+SHIFT+ALT+PF99
4085 CTRL+SHIFT+ALT+CURSOR–UP
4086 CTRL+SHIFT+ALT+CURSOR–DOWN
4087 CTRL+SHIFT+ALT+CURSOR–RIGHT
4088 CTRL+SHIFT+ALT+CURSOR–LEFT
4089 CTRL+SHIFT+ALT+HOME
4090 CTRL+SHIFT+ALT+END
4091 CTRL+SHIFT+ALT+PAGE–UP
4092 CTRL+SHIFT+ALT+PAGE–DOWN
4093 CTRL+SHIFT+ALT+BACK–TAB
4094 CTRL+SHIFT+ALT+INS
4095 CTRL+SHIFT+ALT+HELP–KEY

The above table shows the key labels returned for each key code by the KEYLABEL function. In addition to these key labels, some key codes have alternative labels. Although the KEYLABEL function does not return these values, if you can pass any of these labels to the KEYCODE function, the corresponding key code is returned. The following table lists the alternate key labels.

Table 2. Alternate key codes and key labels
Key code Alternate key label
7 BELL
8 BS
10 LINEFEED, LF
12 FORMFEED, FF
13 RETURN (Windows)

ENTER (UNIX)

27 ESCAPE
127 CANCEL
501 UP, UP–ARROW
502 DOWN, DOWN–ARROW
503 RIGHT, RIGHT–ARROW
504 LEFT, LEFT–ARROW
505 ESC H
507 PGUP, PREV–PAGE, PREV–SCRN
508 PGDN, NEXT–PAGE, NEXT–SCRN
509 SHIFT+TAB (UNIX)

BACK–TAB (Windows)

510 INSERT, INS–CHAR, INS–C, INSERT–HERE
512 DEL–CHAR, DELETE–CHAR, DEL–C
516 INS–L, LINE–INS
517 DEL–L, LINE–DEL