Windows Key | This node informs about keystrokes while the focus is on the renderer window. | |
DirectInput Key | This node informs about every keystroke done on the keyboard. | |
Textfield Input | Concatenates keyboard input received by the renderer window to a single string. |
This node makes it possible to interact with a Ventuz scene via keyboard. It provides information whether a specific key is pressed or not. Additionally, it triggers events when a key is pressed or released.
This node only reacts on key hits that occur within the Renderer window. Key hits outside this window are ignored.
If AutoDeactivate is enabled, this node will be automatically deactivated if the parent Hierarchy Container is blocked. The property Active determines if this node is active and if it should react on the key hits. The property Key defines which key the node listens for. To specify the key, click on the triangle in the Key property argument field and then press the desired key. It is also possible to specify a key combination like CTRL + P.
If SendEventArg is enabled the key code is sent as argument via the KeyDown and KeyUp event which occur if the correct key is pressed. This is usually used when binding a key event to a Script Node so that the key code value is available in the event handler without having to bind an additional property.
If Key is set to None, the node will react on all keyboard inputs!
The Emit method simulates a key stroke and the node behaves as if the specific key on the keyboard has been hit. In this case the KeyUp occurs one frame after the KeyDown event. This Emit can be used to build a Ventuz scene which works identically with a real keyboard and a virtual keyboard on a touch display. By default, an emit will only create a Ventuz-internal key press/release message that will not be sent to Windows or any other application. When enabling EmitSimulatesHardware, the press/release are submitted to Windows instead and will thus create the same behavior as if the user would have pressed a key on his keyboard. This has multiple side-effects:
In addition to the events described above, this node provides information about the state (NotPressed, Pressed) of a specific key and its code (KeyCode).
This node provides nearly the same functionality as Windows Key. But there are two differences: this node notices every key stroke inside and outside the Renderer window and even outside the Ventuz application. It is not possible to send the key code as argument via the events and it is not provided as an output property.
Technically the Textfield Input node is related to the Windows Key node. Both only listen to key presses that are issued when the Renderer Window has keyboard focus. But where the Windows Key node is designed for listening to individual key strokes, the Textfield Input node listens for characters being generated instead of keys being pressed. When a diacritic key is pressed (for example the ^ key), Windows notifies applications of the key being pressed but does not issue a character. Only when a second key is pressed, the combined result (for example â) is sent. For non-accented characters, both the key press and character are sent at the same time.
The Textfield Input node listens for such character messages and concatenates all such characters into a single string that is provided via the Text output property. This is usually bound to a Text Layout/Text Rendering combination to visualize the input. Using Backspace to delete the last character is supported but there is no caret that can be used to specify at which position the next character is inserted.
If the SingleLine property is activated, the Textfield Input node will ignoring new line characters. The PressedEnter event will however fire regardless of the SingleLine property. In addition, MaxLength can be used to restrict the number of characters in the generated string. If set to a value different from -1, any new keypress will only be added to the output string if it does not exceed the limit set in MaxLength.
If the Textfield Input is supposed to be used in conjunction with the Windows Key Emit method, the EmitSimulatesHardware property has to be activated. Otherwise only Ventuz-internal key press/release events are generated which do not cause Windows to send the character messages the Textfield Input node requires.
The InjectChar method accepts an integer value which is translated to a unicode character. When the method is invoked, the browser reacts as if this key would have been inserted via the hardware keyboard. Note that this is not the same as pressing a hardware key. For example, to generate the letter â on a German keyboard takes two key presses, first the ^ key and then the a key. In order to support more languages, the inject method accepts a character and not a key press. There are however a number of special character codes supported:
Code | Description |
---|---|
13 | Return |
9 | Tab |
8 | Backspace |
127 | Delete |
27 | Escape |
The pass an integer value as part of the method invocation, either the output event of a Script node or an Event node has to be used. For the latter, the value can be specified in its Argument property.
The Property Editor accepts hexadecimal numbers if they are entered with a leading "0x" or "#"
The unicode values for the most commonly used characters can be found here and here. Additional information on other character sets can be found here.