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()ortonumber()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 existError 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")), " ", "_")
