getkey (not supported in Axiell Collections)

Syntax

key = GETKEY(code)

Arguments

key: integer

code: 0, 1, 2 or 3

Platform

DOS (not supported in Axiell Collections and RunAdapl.exe)

Meaning

Waits for an ASCII key, function key or function combination and gives the identifying value for it.

GETKEY(0) indicates whether a key has been pressed. The function does not wait for a key to be pressed. key = 1 means that a key has been pressed; otherwise, the result will be 0.

GETKEY(1) returns the ASCII value of the key pressed. If the key that was pressed is either a function key, the edit/cursor key or the Ctrl key, the result will be 0. The Enter, Esc, Backspace, Tab and Backtab keys also give 0 as result.

GETKEY(2) waits for a key to be pressed, and returns the Adlib function code for it. The function codes are shown in the table below. Ordinary ASCII keys return the function code 0. Keys that do not have a valid function or ASCII value give the result -1. Enter, Esc, Backspace, Tab and Backtab are function keys in Adlib.

GETKEY(3) waits for a key to be pressed and returns an ASCII value or an Adlib function code. If a function code is found, it will be returned as a negative number. If an ASCII value is found, the result will be the positive value 1 (GETKEY(2) would then result in -1).

The following table shows the function codes for GETKEY(2)under MS-DOS.

Code

Function

Key

1

Cursor up

2

Cursor down

3

Cursor left

4

Cursor right

5

Home

Home

6

Delete rest of page

Ctrl-C

7

Delete rest of line

Ctrl-L

8

Insert character

Ins

9

Delete character

Del

10

Tab

Tab

11

Backtab

Shift-Tab

12

Backspace

Backspace

13

Insert line

Shift-Ins

14

Delete line

Shift-Del

17

Help

Ctrl-F1

18

Insert line buffer

Ctrl-F2

19

Next field

Ctrl-Tab

20

Previous field

Ctrl-Shift-Tab

21

F1

F1

22

F2

F2

23

F3

F3

24

F4

F4

25

F5

F5

26

F6

F6

27

F7

F7

28

F8

F8

29

F9

F9

30

F10

F10

31

F11

F11/Shift-F1

32

F12

F12/Shift-F2

33

F13

F13/Shift-F3

34

F14

F14/Shift-F4

35

F15

F15/Shift-F5

36

F16

F16/Shift-F6

47

Previous screen

Page Up

48

Next screen

Page Down

49

Confirm action/selection

Enter/Return/

51

Cursor to End

End

54

Escape

Esc

Note that this function does not work when you run the adapl in which it appears as a stand-alone program, through adeval.exe: getkey will cause the adapl to stop running, and the Windows Task Manager has to be used to close the adapl.

When an adapl with this function is called from within Adlib for Windows, getkey always returns zero.