Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ComboBoxSetSelectedMenuItem

From RoR Wiki
Revision as of 19:41, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

  • index is 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 OnSelChanged handler 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 exist
  • Error in function call 'ComboBoxSetSelectedMenuItem': Window %s is not a ComboBoxCast

Example

From default/ea_settingswindow/source/settingswindowtabinterface.lua:

ComboBoxSetSelectedMenuItem( settingsBarName.."NumberButtons", barSettings.buttonCount )

See also