guiComboBoxSetOpen | Multi Theft Auto: Wiki Skip to content

guiComboBoxSetOpen

Client-side
Server-side
Shared

Pair: guiComboBoxIsOpen

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function set combo box state as open or close.

OOP Syntax Help! I don't understand this!

Syntax

bool guiComboBoxSetOpen ( element comboBox, bool state )
Required Arguments
  • comboBox: The combobox to be opened or closed.
  • state: The state of combobox. true, if the combobox is to be opened. false if the combobox is to be closed.

Returns

  • bool: value

Returns true if is successful, false otherwise.

Code Examples

shared

This example opens/closes the combobox after clicking the button.

local isOpened = false
local comboBox = guiCreateComboBox(0.30,0.45,0.30,0.20,'Test',true) -- create the gui combo-box
local openButton = guiCreateButton(0.35,0.31,0.15,0.15,'Show numbers',true) -- create the button
for i = 1,20 do
guiComboBoxAddItem(comboBox, tostring(i)) -- add items
end
addEventHandler('onClientGUIClick',openButton,function()
if not isOpened then
guiComboBoxSetOpen(comboBox, true) -- open the combobox
guiSetText(source, 'Hide numbers')
isOpened = true
else
guiComboBoxSetOpen(comboBox, false) -- close the combobox
guiSetText(source, 'Show numbers')
isOpened = false
end
end)

See Also

GUI Functions