Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SelectionBox

Selection box UI element

Hierarchy

Index

Properties

onSelectionChanged

onSelectionChanged: MulticastDelegate<(selectionBox: this, player: Player, index: number, option: string) => void>

Called when the selection is changed.

param

The selection box that was changed

param

The player who changed the selection. undefined if selection is changed by setSelectedOption or setSelectedIndex.

param

The selected index

param

The selected option

Methods

addOption

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

getSelectedIndex

  • getSelectedIndex(): number
  • Get the index of the currently selected option. -1 if nothing is selected because this selection box has no options.

    Returns number

getSelectedOption

  • getSelectedOption(): string
  • Return the currently selected option

    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

setSelectedIndex

  • Set the index of the currently selected option. Will have no effect if there is no option at that index.

    Parameters

    • index: number

    Returns SelectionBox

setSelectedOption

  • Set the currently selected option. Will not have an effect if no such option exists.

    Parameters

    • text: string

    Returns SelectionBox