Select

Extends: UiWidget

A focusable option picker. Its interaction style is controlled by Select.style (see BGE.UI.SelectStyle): inline (the default) cycles through m.options in place with Left/Right, matching Slider's existing interaction pattern; popup expands a full option list on OK; horizontal shows every option side-by-side in one row, with Left/Right moving directly between them.

Properties

  • options (Array.<dynamic>)
  • selectedIndex (integer)
  • drawableText (BGE.DrawableText)
  • onChanged (function | dynamic) — Called after selectedIndex changes - function(select as Select) as void
  • lastChangedValue (dynamic) — Test accessor: last value an onChanged callback stashed here. Not part
  • style (BGE.UI.SelectStyle) — Which interaction style this Select uses - see BGE.UI.SelectStyle.
  • expanded (boolean) — popup style only: is the option list currently expanded?
  • highlightedIndex (integer) — popup style only: index within m.options currently highlighted while expanded.
  • lastDrawnRowCount (integer) — Test accessor: how many option rows drawOverlay() drew last call. Not
  • optionTextDrawables (object) — popup and horizontal styles only: one BGE.DrawableText per unique
  • repeatThrottle (BGE.UI.RepeatThrottle) — Throttles repeat-while-held Left/Right to one step per

Constructor

new Select(game: BGE.Game): Select

Parameters


Instance Methods

getValue(): dynamic

Returns

  • dynamic

next(): void

Advances to the next option, wrapping to the first after the last.

Returns

  • void

previous(): void

Goes back to the previous option, wrapping to the last after the first.

Returns

  • void

handleInput(input: BGE.GameInput): boolean

Parameters

Returns

  • boolean

onClick(): void

Returns

  • void

onBlur(): void

Returns

  • void

draw(parent?: UiWidget): void

Parameters

  • parent (UiWidget, optional, default: "invalid")

Returns

  • void

drawOverlay(canvas: BGE.Canvas, theme: BGE.UI.Theme): void

Parameters

Returns

  • void

getOptionTextDrawableCount(): integer

Test accessor: how many distinct option strings have a cached DrawableText so far. Not part of the public API - exists purely so tests can confirm optionTextDrawables stays bounded by the option list rather than growing every drawOverlay() call.

Returns

  • integer