Virtual key is a component that turns a [[Button Events|button event]] into a button press on the keyboard in game as if it came from the physical keyboard.
== Usage ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|TargetKey|Key|
|TargetKey|Key| The key to simulate.
|AppendString|String|
|AppendString|String| What text to append if the user is focused into a text field
|ShiftTargetKey|Key|
|ShiftTargetKey|Key| What key to use if the [[Component:VirtualShift|Virtual Shift component]] is taking effect, or shift is held on the physical keyboard.
|ShiftAppendString|String|
|ShiftAppendString|String| What text to append if the user is focused into a text field and if the [[Component:VirtualShift|Virtual Shift component]] is taking effect, or shift is held on the physical keyboard.
|IgnoreShift|Bool|
|IgnoreShift|Bool| Whether to ignore shift and virtual shift keys entirely.
|ModifierKey|{{RootFieldType|RelayRef`1|[[Component:VirtualModifierKey|VirtualModifierKey]]}}|TypeAdv5=true| A key that can act as a special modifier (for example, if you wanted a key on your VR keyboard that appended "Cat!!" every time you type a letter)
|ModifiedTargetKey|Key|
|ModifiedTargetKey|Key| The key to use instead of <code>TargetKey</code> when <code>ModifiedTargetKey</code> is pressed down.
|ModifiedAppendString|String|
|ModifiedAppendString|String| hat text to append if the user is focused into a text field and the key specified by <code>ModifiedTargetKey</code> is pressed down.
|Keyboard|{{RootFieldType|RelayRef`1|[[Component:VirtualKeyboard|VirtualKeyboard]]}}|TypeAdv8=true| The keyboard object this key is a part of.
}}
}}
== Behavior ==
== Behavior ==
When paired with a UIX button or physical button on the same slot, it allows for simulation of key presses as if they came from the actual physical keyboard. This can be used for some funny effects where pressing a button forces the user that pressed it to jump (or, god forbid, make them switch to desktop or VR)
This cannot be used to send key presses outside of Resonite to control the external operating system unless the component is in [[Userspace]].
== Examples ==
== Examples ==
Used in the default and custom community keyboards to allow said keyboards to type into the game and textfields.
What text to append if the user is focused into a text field and if the Virtual Shift component is taking effect, or shift is held on the physical keyboard.
When paired with a UIX button or physical button on the same slot, it allows for simulation of key presses as if they came from the actual physical keyboard. This can be used for some funny effects where pressing a button forces the user that pressed it to jump (or, god forbid, make them switch to desktop or VR)
This cannot be used to send key presses outside of Resonite to control the external operating system unless the component is in Userspace.
Examples
Used in the default and custom community keyboards to allow said keyboards to type into the game and textfields.