KEY_DOWN_SPECIAL

KEY_DOWN_SPECIAL

RETURNS THE CODE OF THE SPECIAL KEY THE USER IS PRESSING

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

ACTION

The system variable KEY_DOWN_SPECIAL returns the code of the special key (CTRL, SHIFT or ALT) the user is pressing with another key. It is usable only in the treatment of event ON_KEY_DOWN happening on a system object.

It indicates if the user presses the keys CTRL, SHIFT or ALT with another key:

Returns 0 if no key CTRL, SHIFT or ALT

Returns 1 if SHIFT

Returns 2 if ALT

Returns 3 if CTRL

Returns 4 if SHIFT and ALT

Returns 5 if SHIFT and CRTL

Returns 6 if ALT and CRTL

SYNTAX: KEY_DOWN_SPECIAL in an expression

USE

  • The system variable KEY_DOWN_SPECIAL is used in the treatment of event ON_KEY_DOWN to know the code of the special key the user is pressing (CTRL, SHIFT or ALT).

ERROR

  • None.

EXAMPLE

rem declare a label

label enter_key

rem an EDIT is created

edit 1:left 1,200:set_focus 1

rem every time a key is pressed 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"

select key_down_special

case 0

print " "+chr$(key_down_code)

case 1

print "SHIFT "+chr$(key_down_code)

case 2

print "ALT "+chr$(key_down_code)

case 3

print "CTRL "+chr$(key_down_code)

case 4

print "SHIFT+ALT "+chr$(key_down_code)

case 5

print "SHIFT+CTRL "+chr$(key_down_code)

case 6

print "ALT+CTRL "+chr$(key_down_code)

end_select

return

SEE ALSO

KEY_DOWN_CODE

KEY_UP_CODE

KEY_UP_SPECIAL

ON_KEY_DOWN

ON_KEY_UP