Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ComboBoxGetSelectedText

From RoR Wiki

UI Lua API · ComboBox functions
Version: WAR 1.4.8

Returns the text of the selected item of a ComboBox.

text = ComboBoxGetSelectedText(comboBoxName)

Arguments

comboBoxName
string – Name of the ComboBox.

Returns

text
wstring – Text of the selected item, as passed to ComboBoxAddMenuItem.

Details

  • The result is a wide string. Use WStringToString() or tonumber() to convert it, as the stock UI does.
  • When no item is selected, no item text is returned. Check ComboBoxGetSelectedMenuItem first if the ComboBox may have no selection.

Errors

The error messages use the name GetSelectedText:

  • Error in function call 'GetSelectedText': Window %s does not exist
  • Error in function call 'GetSelectedText': Window %s is not a ComboBox

Example

From default/ea_settingswindow/source/settingswindowtabinterface.lua:

local rows = tonumber( ComboBoxGetSelectedText( comboBoxName ) )

From interfacecore/source/characterselectwindow.lua:

local realName = string.gsub(WStringToString(ComboBoxGetSelectedText("CharacterSelectTemplateOptionsComboBox")), " ", "_")

See also