Keyboard
Extends: UiWidget
An on-screen keyboard for roScreen games (Roku's own keyboards are SceneGraph-only): the d-pad moves a highlighted key and OK presses it, typing into a TextInput. Show it with show(), or set TextInput.keyboard so OK on the input opens it.
While it's open: Back cancels and restores the text, Play (or the Done key) finishes, Replay deletes and Fast-forward types a space. Characters from the Roku mobile app's keyboard still reach the target. In pointer focus mode, moving the cursor onto a key highlights it.
Properties
layout(BGE.UI.KeyboardLayout) — Keys and highlight - see createAlphabeticalKeyboardLayout(), createQwertyKeyboardLayout()target(BGE.UI.TextInput) — The TextInput being typed into, set by show().onDone(function | dynamic) — Called after Done hides the keyboard - sub(keyboard as BGE.UI.Keyboard)onCancel(function | dynamic) — Called after Cancel restores the text and hides the keyboard - sub(keyboard as BGE.UI.Keyboard)backgroundRGBA(integer) — Panel colour behind the keys.keyGap(float) — Pixels between keys.gridBuildCount(integer) — Test accessor: how many times the key grid has been baked.
Constructor
new Keyboard(
game: BGE.Game,
layout?: BGE.UI.KeyboardLayout,
): KeyboardParameters
game(BGE.Game)layout(BGE.UI.KeyboardLayout, optional, default: "invalid") — defaults to createAlphabeticalKeyboardLayout()
Instance Methods
show(parent: BGE.UI.UiContainer, target: BGE.UI.TextInput): void
Adds the keyboard to parent, focuses it and starts typing into target, on the first page with the first key highlighted. Cancel restores the target's text from now.
Parameters
parent(BGE.UI.UiContainer)target(BGE.UI.TextInput)
Returns
void
hide(): void
Removes the keyboard from its container (so it stops taking focus) and refocuses the target.
Returns
void
onDestroy(): void
Returns
void
isShown(): boolean
Returns
boolean— true between show() and hide()
done(): void
Hides the keyboard, then fires onDone and the target's onSubmit.
Returns
void
cancel(): void
Restores the target's text from when show() was called, hides, then fires onCancel.
Returns
void
pressKey(key: BGE.UI.KeyboardKey): void
Acts on a key as if it were pressed.
Parameters
key(BGE.UI.KeyboardKey)
Returns
void
onClick(): void
Returns
void
onECPKeyboard(char: integer): void
Parameters
char(integer)
Returns
void
handleInput(input: BGE.GameInput): boolean
Parameters
input(BGE.GameInput)
Returns
boolean
onUpdate(deltaTime: float): void
Parameters
deltaTime(float)
Returns
void
draw(parent?: UiWidget): void
Parameters
parent(UiWidget, optional, default: "invalid")
Returns
void