Window.postInputEvent

Function/Meaning

Generate input event

Type
Windowclassmethod of
Syntax
postInputEvent(eventname, params=null)
Arguments
eventname

Specify the event name.
Specify with the following character string.

  • "onKeyDown" will generate a Window.onKeyDown event.
  • "onKeyPress" will generate a Window.onKeyPress event.
  • "onKeyUp" will generate a Window.onKeyUp event.

Since onKeyDown and onKeyUp are paired, it is recommended to generate the corresponding onKeyUp when onKeyDown is generated.

params

Specifies a dictionary array that contains event parameters.
In the "onKeyDown" and "onKeyUp" events, the virtual key code is stored in "key" and the shift state is stored in "shift".
If "shift" is omitted, it is considered to be 0.
In the "onKeyPress" event, specify a character for "key".

Return value
None (void)
Explanation

Generates an input event.
The current version can generate three keystroke events.
This method generates the event as an asynchronous event.
That is, this method returns without waiting for the corresponding event handler to finish.
The event handler is actually called and processed only after control is returned to Kirikiri.
In addition to the Window class, the input event also occurs as the corresponding event of the Layer class, just like a normal input event.
Example:


postInputEvent ('onKeyDown',% [key: VK_UP, shift: ssShift]);
postInputEvent ('onKeyUp',% [key: VK_UP, shift: ssShift]);
// Press the left cursor key