ComboBox

From Crumbled World Wiki
Revision as of 13:41, 5 July 2025 by Anders (talk | contribs) (Created page with "{{:ComboBoxExampleCode}} ==Inheritance== Panel ==Constructor== {| class="wikitable" !|function !|description |- |ComboBox(PanelSize size) | |- |ComboBox(PanelSize size, string text) | |- |} ==Functions== {| class="wikitable" !|return !|function !|description |- |Text |getText() |Get text. |- |int |getInt() |Get text. |- |float |getFloat() |Get text. |- | |ComboBox:setText(string te...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Example

function changeSetting(button)
	comboBox:setText(button:getTag())
end

comboBox = panel:add(ComboBox(PanelSize(size), items[1]))
local items = {"item1","item2","item3","item4"}

for i=1, #items do
	local itemButton = comboBox:addItem( Button(PanelSize(Vec2(-1,0.03)), items[i]) )
	itemButton:setTag(items[i])
	itemButton:addEventCallbackExecute(changeSetting)
end

Inheritance

Panel

Constructor

function description
ComboBox(PanelSize size)
ComboBox(PanelSize size, string text)

Functions

return function description
Text getText() Get text.
int getInt() Get text.
float getFloat() Get text.
setText(string text) Set text.
setText(Text text) Set text.
Panel addItem(Panel item) Add a drop down menu item.
removeItem(Panel item) Remove a drop down menu item.
clearItems() Removes all drop down menu items.
hideDropDownMenu()
showDropDownMenu()