Skip to main content
Version: v2.4.0 (Current)

⌨️ Keyboard

The Keyboard widget is a specialized input interface that allows users to enter text and numeric data. It is essentially an optimized Button Matrix with built-in logic for handling character mapping, shift states, and cursor control.


⚙️ Properties (Props)

The Keyboard configuration is defined by the KeyboardWidget interface. Its primary function is to act as an input provider for another widget.

PropertyTypeDescription
Target TextwidgetIdThe ID of the Text Input or Label widget where the characters will be sent.
ModeDropdownSwitch between layouts: Text, Number, or Special Characters.
Pop-upbooleanIf enabled, the keyboard only appears when the target widget is focused.

🛠 Target Integration

The Keyboard does not store text itself; it manipulates a Target.

  1. Binding: In the Inspector Panel, use the Target picker to select a Text Area.
  2. Interaction: When a user clicks a key, the Keyboard sends the character to the target's cursor position.
  3. Completion: The "Enter" or "Check" key on the keyboard typically triggers a READY event, allowing you to validate the input.

🎨 Visual Layouts

Artok supports several built-in maps that change the keyboard's appearance instantly:

  • QWERTY: Full alphanumeric layout for names and descriptions.
  • Number Pad: Large keys optimized for PIN entry or setting numeric values (like temperature).
  • Hexadecimal: Optimized for engineering tools requiring hex input (0-F).

⚡ Runtime API (Lua)

You can use the Logic and Events system to control the keyboard's visibility and behavior.

-- Change the target widget at runtime
kb_main:set_textarea(input_username)

-- Force the keyboard into numeric mode for a specific field
kb_main:set_mode("number")

-- Manually show or hide the keyboard
kb_main:set_hidden(false)

MEMORY SAVING

Instead of placing a keyboard on every screen, create one global keyboard on a Top Layer and use Lua to update its targetText whenever a user clicks an input field.


🚀 Next Steps

  • Text Area — The most common target for keyboard input.
  • Button Matrix — Use this if you need a completely custom grid of keys (like a calculator).
  • Logic and Events — Learn how to capture the READY event to save user input.