<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AComboBoxAddMenuItem</id>
	<title>API:ComboBoxAddMenuItem - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AComboBoxAddMenuItem"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:ComboBoxAddMenuItem&amp;action=history"/>
	<updated>2026-10-17T18:28:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:ComboBoxAddMenuItem&amp;diff=30250&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:ComboBoxAddMenuItem&amp;diff=30250&amp;oldid=prev"/>
		<updated>2026-10-16T19:41:36Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=ComboBox}}&lt;br /&gt;
Adds an item to the end of a ComboBox&amp;#039;s menu.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ComboBoxAddMenuItem(comboBoxName, text)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;comboBoxName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the ComboBox.&lt;br /&gt;
;text : &amp;lt;code&amp;gt;wstring&amp;lt;/code&amp;gt; – Text of the new item. It must be a wide string: &amp;lt;code&amp;gt;L&amp;quot;Option&amp;quot;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;towstring(3)&amp;lt;/code&amp;gt; work, &amp;lt;code&amp;gt;&amp;quot;Option&amp;quot;&amp;lt;/code&amp;gt; does not.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Nothing.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* Items are numbered from 1 in the order they are added. Use that number with [[API:ComboBoxSetSelectedMenuItem|ComboBoxSetSelectedMenuItem]] and [[API:ComboBoxGetSelectedMenuItem|ComboBoxGetSelectedMenuItem]].&lt;br /&gt;
* Adding an item does not change the selection.&lt;br /&gt;
* Passing an ordinary Lua string raises an &amp;#039;&amp;#039;Invalid Parameters&amp;#039;&amp;#039; error.&lt;br /&gt;
* The function needs at least two arguments and only reads the last two. Any extra arguments placed in front of them are ignored.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
The type error says &amp;lt;code&amp;gt;ComboBoxCast&amp;lt;/code&amp;gt;:&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;ComboBoxAddMenuItem&amp;#039;: Window %s does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;ComboBoxAddMenuItem&amp;#039;: Window %s is not a ComboBoxCast&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Rebuilding a menu, from &amp;lt;code&amp;gt;default/ea_settingswindow/source/settingswindowtabinterface.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ComboBoxClearMenuItems( settingsBarName..&amp;quot;Rows&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
local numMenuItems = 1&lt;br /&gt;
local halfButtons = math.floor( numButtons / 2 )&lt;br /&gt;
for j = 1, halfButtons&lt;br /&gt;
do&lt;br /&gt;
    if( math.fmod( numButtons, j ) == 0 )&lt;br /&gt;
    then&lt;br /&gt;
        ComboBoxAddMenuItem(  settingsBarName..&amp;quot;Rows&amp;quot;, towstring( j ) )&lt;br /&gt;
&lt;br /&gt;
        if( rows == j )&lt;br /&gt;
        then&lt;br /&gt;
            ComboBoxSetSelectedMenuItem( settingsBarName..&amp;quot;Rows&amp;quot;, numMenuItems )&lt;br /&gt;
        end&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:ComboBoxClearMenuItems|ComboBoxClearMenuItems]]&lt;br /&gt;
* [[API:ComboBoxSetSelectedMenuItem|ComboBoxSetSelectedMenuItem]]&lt;br /&gt;
* [[API:ComboBoxGetSelectedText|ComboBoxGetSelectedText]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>