Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TextBox

An editable text box UI element

Hierarchy

Index

Properties

onTextChanged

onTextChanged: MulticastDelegate<(textBox: this, player: Player, text: string) => void>

Called when the edited text changes.

param

The text box where the text changed

param

The player that changed the text. undefined if the text was changed through setText.

param

The new text

Methods

getInputType

  • getInputType(): number
  • Return the type of input this text box accepts. 0 - Any string 1 - Real numbers, positive or negative 2 - Real numbers, positive only 3 - Whole numbers, positive or negative 4 - Whole numbers, positive only

    Returns number

getMaxLength

  • getMaxLength(): number
  • Return the maximum number of characters allowed for this text box

    Returns number

getOwningObject

getParent

  • getParent(): Widget | undefined
  • Return the widget that contains this widget, for example a border that wraps a check box. Returns undefined if this object has no parent.

    Returns Widget | undefined

getText

  • getText(): string
  • Return the currently displayed text.

    Returns string

isEnabled

  • isEnabled(): boolean

setEnabled

  • setEnabled(enabled: boolean): Widget
  • Set whether the widget is enabled. When a widget is disabled, users can't interact with it and it is greyed out. When a widget that contains other widgets (like VerticalBox) is disabled, all its children behave as if disabled, too. By default, widgets are enabled.

    Parameters

    • enabled: boolean

      Whether to enable the widget.

    Returns Widget

setFontSize

  • setFontSize(size: number): TextBox
  • Set the font size.

    Parameters

    • size: number

      The new font size. Default: 12

    Returns TextBox

setInputType

  • setInputType(type: number): TextBox
  • Set the type of input this text box accepts. 0 - Any string 1 - Real numbers, positive or negative 2 - Real numbers, positive only 3 - Whole numbers, positive or negative 4 - Whole numbers, positive only

    Parameters

    • type: number

      The new input type

    Returns TextBox

setMaxLength

  • setMaxLength(length: number): TextBox
  • Set the maximum number of characters allowed for this text box

    Parameters

    • length: number

      Maximum number of characters. Must be between 1 and 255. Default: 100

    Returns TextBox

setText