Skip to content

ComboBox

The GenericUI_Element_ComboBox element implements a combobox form element. The user may change its value to any labelled one from a predefined list.

You can set its options with SetOptions() or AddOption(). Comboboxes contain no options by default.

GenericUI_Element_ComboBox Class

Inherits from GenericUI_Element.

Methods

AddOption
function GenericUI_Element_ComboBox:AddOption(id, label)

Adds an option to the combobox.

@param id string

@param label string

ClearOptions
function GenericUI_Element_ComboBox:ClearOptions()

Removes all options from the combobox.

GetOptions
function GenericUI_Element_ComboBox:GetOptions()
   -> GenericUI_Element_ComboBox_Option[]

Returns the available options.

IsOpen
function GenericUI_Element_ComboBox:IsOpen()
   -> boolean

Returns whether the combobox is open.

SelectOption
function GenericUI_Element_ComboBox:SelectOption(id)

Sets the currently selected option.

@param id string

SetOpenUpwards
function GenericUI_Element_ComboBox:SetOpenUpwards(openUpwards)

Sets whether the combobox should open upwards, or downwards (default)

Use to determine the orientation of the options selector when opened.

@param openUpwards boolean

SetOptions
function GenericUI_Element_ComboBox:SetOptions(options)

Sets the options for the combobox. Equivalent to calling ClearOptions() then AddOption() for each option in the list passed.

@param options GenericUI_Element_ComboBox_Option[]