API:ComboBoxSetSelectedMenuItem
From RoR Wiki
UI Lua API · ComboBox functions
Version: WAR 1.4.8
Selects an item of a ComboBox.
ComboBoxSetSelectedMenuItem(comboBoxName, index)
Arguments
- comboBoxName
string– Name of the ComboBox.- index
number– Number of the item to select, counted from 1 in the order the items were added. Use 0 to clear the selection.
Returns
Nothing.
Details
indexis converted to a whole number.- The ComboBox's selected-item button shows the text of the chosen item.
- An index that does not match an item (0, a negative number, or a number above the item count) clears the selection, and the selected-item text becomes empty.
- The ComboBox's
OnSelChangedhandler is not run by this function. It runs only when the user picks an item, or when ComboBoxClearMenuItems clears a selection. - If the item is already selected, nothing happens.
- The function needs at least two arguments and only reads the last two. Any extra arguments placed in front of them are ignored.
Errors
The type error says ComboBoxCast:
Error in function call 'ComboBoxSetSelectedMenuItem': Window %s does not existError in function call 'ComboBoxSetSelectedMenuItem': Window %s is not a ComboBoxCast
Example
From default/ea_settingswindow/source/settingswindowtabinterface.lua:
ComboBoxSetSelectedMenuItem( settingsBarName.."NumberButtons", barSettings.buttonCount )
