OnKeyDown picture event


Declaration


ENTRY OnKeyDown(IN INT _VKCode, IN BOOL _bCtrl, IN BOOL _bShift, IN BOOL _bAlt)
 ; script actions
 END OnKeyDown


Parameters
_VKCodeCode of pressed key.
_bCtrlAttribute of the CTRL key state when the key _VKCode is pressed.
_bShiftAttribute of the SHIFT key state when the key _VKCode is pressed.
_bAltAttribute of the ALT key state when the key _VKCode is pressed.
Description

The picture event is being generated when any hot key defined by function %HI_RegKeyHandler is pressed.

Unlike ENTRY OnKeyPress, an event is called even if the picture does not handle user input (has no focus) or is hidden (invisible). From the point of view of the user input operator, the event is called asynchronously and therefore has only an informative character - "the user pressed a defined key combination". The event is called even if there is a collision between system and application-defined keyboard shortcuts. If there are several pictures open at the same time in the HI process that serve the input, they operate independently of each other and are not affected in any way.

The value of the parameter _VKCode uniquely identifies the pressed key. The next three parameters identifies the states of the CTRL, SHIFT and ALT keys. Codes assigned to keys are constants and they are defined by OS OS MS Windows.

Example
The example contains en easy method to detect the values of the parameter _VKCode for keys.
 
ENTRY OnKeyDown(IN INT _VKCode, IN  BOOL _bCtrl, IN  BOOL  _bShift, IN  BOOL _bAlt)
   TEXT _msg
 
   _msg := "_VKCode = " + %IToStr(_VKCode)
   IF _bCtrl THEN
     _msg := _msg + " +CTRL"
   ENDIF
   IF _bAlt THEN
     _msg := _msg + " +ALT"
   ENDIF
   IF _bShift THEN
     _msg := _msg + " +SHIFT"
   ENDIF
   MESSAGE _msg ON _FROM_HIP
 END OnKeyDown
Napíšte komentár