Skip to content

Keyboard Control

Nikita Yudin edited this page May 4, 2024 · 2 revisions

Description

Keyboard control module adds useful methods to control keyboard input.

Properties

Let's look on list of all available properties:

Name Type Default Description
initialized bool false Whether the keyboard control is initialized.
enabled bool false Whether the keyboard control is enabled.
page_up_down bool true When enabled it will enable keyboard navigation by Page Up and Page Down keys.
threshold_strength float 0.5 Minimum input strength to trigger item change. See more: method Input.get_action_strength.
next_action_name String ui_right Action name for next item.
prev_action_name String ui_left Action name for previous item.
input_handled bool true Stops the input from propagating further down the SceneTree. If true then does not allow scrolling in ScrollContainer.
release_on_edges int 4 Set to true and will release input event and allow page left/right when on edge positions (in the beginning or in the end).
keyboard_allow_echo bool false Set to true to allow echo event.

Methods

After we initialize we have its initialized instance in variable with helpful methods:

Name Return Description
initialize(viewport: Viewport) void Initialize keyboard control.
disable() void Disable keyboard control.
enable() void Enable keyboard control.
set_edges(edge_start: bool, edge_end: bool) void Set to true and will release input event and allow page left/right when on edge positions (in the beginning or in the end).
input(event: InputEvent) void Called when there is an input event.

Signals

Name Description
prev_input Event is triggered when key is pressed to enter previous value.
next_input Event is triggered when key is pressed to enter next value.