GuiComboBoxIsOpen: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Client function}} __NOTOC__ {{New feature/item|3.0157|1.5.6|14489|This function returns the state of combobox.}} ==Syntax== <syntaxhighlight lang="lua"> bool guiComboBoxIs...") |
(Modify example) |
||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
This example | This example opens/closes the combobox after clicking the button. Checking if combobox is opened and change button text. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local comboBox = guiCreateComboBox(0.30,0.45,0.30,0.20,'Test',true) -- create the gui combo-box | 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 | for i = 1,20 do | ||
Line 23: | Line 24: | ||
end | end | ||
addEventHandler(' | addEventHandler('onClientGUIClick',openButton,function() | ||
if | if not guiComboBoxIsOpen(comboBox) then | ||
guiComboBoxSetOpen(comboBox, true) -- open the combobox | |||
guiSetText(source, 'Hide numbers') | |||
else | |||
guiComboBoxSetOpen(comboBox, false) -- close the combobox | |||
guiSetText(source, 'Show numbers') | |||
end | end | ||
end) | end) |
Revision as of 17:09, 23 September 2018
This function returns the state of combobox.
Syntax
bool guiComboBoxIsOpen( element comboBox )
Required Arguments
- comboBox: The combo box to get the state.
Returns
Returns true if combobox is opened, false if combobox is closed, nil otherwise.
Example
This example opens/closes the combobox after clicking the button. Checking if combobox is opened and change button text.
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 guiComboBoxIsOpen(comboBox) then guiComboBoxSetOpen(comboBox, true) -- open the combobox guiSetText(source, 'Hide numbers') else guiComboBoxSetOpen(comboBox, false) -- close the combobox guiSetText(source, 'Show numbers') end end)
See Also
General functions
- guiBringToFront
- getChatboxLayout
- getChatboxCharacterLimit
- guiCreateFont
- guiBlur
- guiFocus
- guiGetAlpha
- guiGetCursorType
- guiGetEnabled
- guiGetFont
- guiGetInputEnabled
- guiGetInputMode
- guiGetPosition
- guiGetProperties
- guiGetProperty
- guiGetScreenSize
- guiGetSize
- guiGetText
- guiGetVisible
- guiMoveToBack
- guiSetAlpha
- guiSetEnabled
- guiSetFont
- guiSetInputEnabled
- guiSetInputMode
- guiSetPosition
- guiSetProperty
- guiSetSize
- guiSetText
- guiSetVisible
- isChatBoxInputActive
- isConsoleActive
- isDebugViewActive
- isMainMenuActive
- isMTAWindowActive
- isTransferBoxActive
- setChatboxCharacterLimit
- setDebugViewActive
Browsers
Buttons
Checkboxes
Comboboxes
- guiCreateComboBox
- guiComboBoxAddItem
- guiComboBoxClear
- guiComboBoxGetItemCount
- guiComboBoxGetItemText
- guiComboBoxGetSelected
- guiComboBoxIsOpen
- guiComboBoxRemoveItem
- guiComboBoxSetItemText
- guiComboBoxSetOpen
- guiComboBoxSetSelected
Edit Boxes
- guiCreateEdit
- guiEditGetCaretIndex
- guiEditGetMaxLength
- guiEditIsMasked
- guiEditIsReadOnly
- guiEditSetCaretIndex
- guiEditSetMasked
- guiEditSetMaxLength
- guiEditSetReadOnly
Gridlists
- guiCreateGridList
- guiGridListAddColumn
- guiGridListAddRow
- guiGridListAutoSizeColumn
- guiGridListClear
- guiGridListGetColumnCount
- guiGridListGetColumnTitle
- guiGridListGetColumnWidth
- guiGridListGetHorizontalScrollPosition
- guiGridListGetItemColor
- guiGridListGetItemData
- guiGridListGetItemText
- guiGridListGetRowCount
- guiGridListGetSelectedCount
- guiGridListGetSelectedItem
- guiGridListGetSelectedItems
- guiGridListGetSelectionMode
- guiGridListIsSortingEnabled
- guiGridListGetVerticalScrollPosition
- guiGridListInsertRowAfter
- guiGridListRemoveColumn
- guiGridListRemoveRow
- guiGridListSetColumnTitle
- guiGridListSetColumnWidth
- guiGridListSetHorizontalScrollPosition
- guiGridListSetItemColor
- guiGridListSetItemData
- guiGridListSetItemText
- guiGridListSetScrollBars
- guiGridListSetSelectedItem
- guiGridListSetSelectionMode
- guiGridListSetSortingEnabled
- guiGridListSetVerticalScrollPosition
Memos
- guiCreateMemo
- guiMemoGetCaretIndex
- guiMemoGetVerticalScrollPosition
- guiMemoSetVerticalScrollPosition
- guiMemoIsReadOnly
- guiMemoSetCaretIndex
- guiMemoSetReadOnly
Progressbars
Radio Buttons
Scrollbars
Scrollpanes
- guiCreateScrollPane
- guiScrollPaneGetHorizontalScrollPosition
- guiScrollPaneGetVerticalScrollPosition
- guiScrollPaneSetHorizontalScrollPosition
- guiScrollPaneSetScrollBars
- guiScrollPaneSetVerticalScrollPosition
Static Images
Tab Panels
Tabs
Text Labels
- guiCreateLabel
- guiLabelGetColor
- guiLabelGetFontHeight
- guiLabelGetTextExtent
- guiLabelSetColor
- guiLabelSetHorizontalAlign
- guiLabelSetVerticalAlign
Windows
Input
GUI
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel