| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== KEYSTATE (return keyboard status) ====== | [[keychar return ascii code .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[lastfield return last window control .htm|{{btn_next_n.gif|Next page}}]] | | || **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 return last keycode .htm|KEYCODE]] [[band return bitwise and .htm|BAND]] [[keycode equates list.htm|Keycode Equates List]]