Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ComboBoxAddMenuItem

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

Adds an item to the end of a ComboBox's menu.

ComboBoxAddMenuItem(comboBoxName, text)

Arguments

comboBoxName
string – Name of the ComboBox.
text
wstring – Text of the new item. It must be a wide string: L"Option" or towstring(3) work, "Option" does not.

Returns

Nothing.

Details

  • Items are numbered from 1 in the order they are added. Use that number with ComboBoxSetSelectedMenuItem and ComboBoxGetSelectedMenuItem.
  • Adding an item does not change the selection.
  • Passing an ordinary Lua string raises an Invalid Parameters error.
  • 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 'ComboBoxAddMenuItem': Window %s does not exist
  • Error in function call 'ComboBoxAddMenuItem': Window %s is not a ComboBoxCast

Example

Rebuilding a menu, from default/ea_settingswindow/source/settingswindowtabinterface.lua:

ComboBoxClearMenuItems( settingsBarName.."Rows" )

local numMenuItems = 1
local halfButtons = math.floor( numButtons / 2 )
for j = 1, halfButtons
do
    if( math.fmod( numButtons, j ) == 0 )
    then
        ComboBoxAddMenuItem(  settingsBarName.."Rows", towstring( j ) )

        if( rows == j )
        then
            ComboBoxSetSelectedMenuItem( settingsBarName.."Rows", numMenuItems )
        end
        ...

See also