KEY_DOWN_CODE

KEY_DOWN_CODE

RETURNS THE CODE OF THE KEY THE USER IS PRESSING

  • Type: System Variable
  • Parameter: 0
  • Group: Events

ACTION

The system variable KEY_DOWN_CODE returns the code of the key the user is pressing. It is usable only in the treatment of event ON_KEY_DOWN happening on a system object.

The system variable is associated with KEY_DOWN_SPECIAL which indicates if the keys CTRL, SHIFT or ALT have been used at the same time.

SYNTAX: KEY_DOWN_CODE in an expression

USE

  • The system variable KEY_DOWN_CODE is used in the treatment of event ON_KEY_DOWN to know the code of the key the user is pressing.

ERROR

  • None.

EXAMPLE

rem declare a label

label enter_key

rem an EDIT is created

edit 1:set_focus 1

rem every time a key is released in EDIT, execute from label "enter_key"

on_key_down 1,enter_key

end: rem main program is finished

enter_key:

rem treatment of event

if key_down_code=13 then caption 0,"ENTER is pressed"

return

SEE ALSO

KEY_DOWN_SPECIAL

KEY_UP_CODE

KEY_UP_SPECIAL

ON_KEY_DOWN

ON_KEY_UP