Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ComboBoxExternalOpenMenu

From RoR Wiki

UI Lua API · ComboBox functions
Version: WAR 1.4.8

Opens a ComboBox's drop-down menu from script, as if the user had clicked it.

opened = ComboBoxExternalOpenMenu(comboBoxName)

Arguments

comboBoxName
string – Name of the ComboBox.

Returns

opened
boolean – false if the menu was already open; true otherwise.

Details

  • If the menu is already open, nothing happens and the function returns false.
  • A disabled ComboBox (see ComboBoxSetDisabledFlag) does not open, but the function still returns true. Use ComboBoxIsMenuOpen afterwards if you need to know whether the menu really opened.

Errors

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

Example

From default/ea_tacticswindow/source/tacticswindow.lua:

-- If we just open every time an empty slot is clicked, then the menu closes on the L button down event (due to C++ code)
-- and then opens on the LButtonUp, which is probably not what the user is expecting to see.
if (button:GetId() == 0) and (TacticsEditor.openMenuOnNextClick) then
    ComboBoxExternalOpenMenu("EA_TacticsEditorContentsSetMenu");
end

See also