Try OpenEdge Now
skip to main content
Programming Interfaces
Input/Output Processes : Handling User Input : Key codes and key labels
 

Key codes and key labels

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 20. 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 Table 36 table.
Table 35. 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
CURSORUP
502
CURSORDOWN
503
CURSORRIGHT
504
CURSORLEFT
505
HOME
506
END
507
PAGEUP
508
PAGEDOWN
509
BACKTAB
510
INS
511
HELPKEY
512
DELETE
513
EXECUTE
514
PAGE
515
FIND
516
INSLINE
517
DELLINE
518
LINEERASE
519
PAGEERASE
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
MOUSESELECTUP
610
MOUSEMOVEUP
611
MOUSEMENUUP
612
MOUSEEXTENDUP
617
MOUSESELECTDOWN
618
MOUSEMOVEDOWN
619
MOUSEMENUDOWN
620
MOUSEEXTENDDOWN
625
MOUSESELECTCLICK
626
MOUSEMOVECLICK
627
MOUSEMENUCLICK
628
MOUSEEXTENDCLICK
640
MOUSEMOVE
649
MOUSESELECTDBLCLICK
650
MOUSEMOVEDBLCLICK
651
MOUSEMENUDBLCLICK
652
MOUSEEXTENDDBLCLICK
812 through 911
SHIFT+F0 through SHIFT+F99
912 through 1011
SHIFT+ PF0 through SHIFT+PF99
1013
SHIFT+CURSORUP
1014
SHIFT+CURSORDOWN
1015
SHIFT+CURSORRIGHT
1016
SHIFT+CURSORLEFT
1017
SHIFT+HOME
1018
SHIFT+END
1019
SHIFT+PAGEUP
1020
SHIFT+PAGEDOWN
1021
SHIFT+BACKTAB
1022
SHIFT+INS
1023
SHIFT+HELPKEY
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+CURSORUP
1526
ALT+CURSORDOWN
1527
ALT+CURSORRIGHT
1528
ALT+CURSORLEFT
1529
ALT+HOME
1530
ALT+END
1531
ALT+PAGEUP
1532
ALT+PAGEDOWN
1533
ALT+BACKTAB
1534
ALT+INS
1535
ALT+HELPKEY
1536
ALT+DELETE
1537
ALT+EXECUTE
1538
ALT+PAGE
1539
ALT+FIND
1540
ALT+INSLINE
1541
ALT+DELLINE
1542
ALT+LINEERASE
1543
ALT+PAGEERASE
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+CURSORUP
2038
SHIFT+ALT+CURSORDOWN
2039
SHIFT+ALT+CURSORRIGHT
2040
SHIFT+ALT+CURSORLEFT
2041
SHIFT+ALT+HOME
2042
SHIFT+ALT+END
2043
SHIFT+ALT+PAGEUP
2044
SHIFT+ALT+PAGEDOWN
2045
SHIFT+ALT+BACKTAB
2046
SHIFT+ALT+INS
2047
SHIFT+ALT+HELPKEY
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+CURSORUP
2550
CTRL+CURSORDOWN
2551
CTRL+CURSORRIGHT
2552
CTRL+CURSORLEFT
2553
CTRL+HOME
2554
CTRL+END
2555
CTRL+PAGEUP
2556
CTRL+PAGEDOWN
2557
CTRL+BACKTAB
2558
CTRL+INS
2559
CTRL+HELPKEY
2560
CTRL+DELETE
2561
CTRL+EXECUTE
2562
CTRL+PAGE
2563
CTRL+FIND
2564
CTRL+INSLINE
2565
CTRL+DELLINE
2566
CTRL+LINEERASE
2567
CTRL+PAGEERASE
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+CURSORUP
3062
CTRL+SHIFT+CURSORDOWN
3063
CTRL+SHIFT+CURSORRIGHT
3064
CTRL+SHIFT+CURSORLEFT
3065
CTRL+SHIFT+HOME
3066
CTRL+SHIFT+END
3067
CTRL+SHIFT+PAGEUP
3068
CTRL+SHIFT+PAGEDOWN
3069
CTRL+SHIFT+BACKTAB
3070
CTRL+SHIFT+INS
3071
CTRL+SHIFT+HELPKEY
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+CURSORUP
3574
CTRL+ALT+CURSORDOWN
3575
CTRL+ALT+CURSORRIGHT
3576
CTRL+ALT+CURSORLEFT
3577
CTRL+ALT+HOME
3578
CTRL+ALT+END
3579
CTRL+ALT+PAGEUP
3580
CTRL+ALT+PAGEDOWN
3581
CTRL+ALT+BACKTAB
3582
CTRL+ALT+INS
3583
CTRL+ALT+HELPKEY
3585
CTRL+ALT+EXECUTE
3586
CTRL+ALT+PAGE
3587
CTRL+ALT+FIND
3588
CTRL+ALT+INSLINE
3589
CTRL+ALT+DELLINE
3590
CTRL+ALT+LINEERASE
3591
CTRL+ALT+PAGEERASE
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+CURSORUP
4086
CTRL+SHIFT+ALT+CURSORDOWN
4087
CTRL+SHIFT+ALT+CURSORRIGHT
4088
CTRL+SHIFT+ALT+CURSORLEFT
4089
CTRL+SHIFT+ALT+HOME
4090
CTRL+SHIFT+ALT+END
4091
CTRL+SHIFT+ALT+PAGEUP
4092
CTRL+SHIFT+ALT+PAGEDOWN
4093
CTRL+SHIFT+ALT+BACKTAB
4094
CTRL+SHIFT+ALT+INS
4095
CTRL+SHIFT+ALT+HELPKEY
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 36. 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, UPARROW
502
DOWN, DOWNARROW
503
RIGHT, RIGHTARROW
504
LEFT, LEFTARROW
505
ESC H
507
PGUP, PREVPAGE, PREVSCRN
508
PGDN, NEXTPAGE, NEXTSCRN
509
SHIFT+TAB (UNIX)
BACKTAB (Windows)
510
INSERT, INSCHAR, INSC, INSERTHERE
512
DELCHAR, DELETECHAR, DELC
516
INSL, LINEINS
517
DELL, LINEDEL