KEYSTATE (return keyboard status)

Top  Previous  Next

 

KEYSTATE( )

The KEYSTATE procedure returns a bitmap containing the status of the SHIFT, CTRL, ALT, any extended key, CAPS LOCK, NUM LOCK, SCROLL LOCK, and INSERT keys for the last KEYCODE procedure return value. The bitmap is contained in the high-order byte of the returned SHORT.

x . . . . . . .  insert key  (8000h)

. x . . . . . .  scroll lock (4000h)

. . x . . . . .  num lock    (2000h)

. . . x . . . .  caps lock   (1000h)

. . . . x . . .  extended    (0800h)

. . . . . x . .  alt         (0400h)

. . . . . . x .  ctrl        (0200h)

. . . . . . . x  shift       (0100h)

 

Return Data Type:

UNSIGNED

Example:

ACCEPT                       !Loop on the display

CASE KEYCODE()              !Process the keystroke

OF EnterKey                 !User pressed Enter

 IF BAND(KEYSTATE(),0800h)  !Detect enter on numeric keypad

  PRESSKEY(TabKey)          !press tab for the user

 END

END

END

See Also:

KEYCODE

BAND

Keycode Equates List