GuiComboBoxClear: Difference between revisions
Jump to navigation
Jump to search
(Syntax added. Example needed.) |
|||
Line 14: | Line 14: | ||
Returns ''true'' if the combobox element is valid and has been cleared successfully, ''false'' otherwise. | Returns ''true'' if the combobox element is valid and has been cleared successfully, ''false'' otherwise. | ||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | |||
This example creates a combo box with all server vehicles on it, with a command to clear the combo box. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | addEventHandler ( "onClientResourceStart", resourceRoot, | ||
function ( ) | |||
vehiclesComboBox = guiCreateComboBox ( 400, 100, 200, 5 * #getElementsByType ( "vehicle" ), "", false ) -- We create a combo box. | |||
for index, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do -- We loop through all vehicles. | |||
guiComboBoxAddItem ( vehiclesComboBox, getVehicleName ( vehicle ) ) -- We add the vehicle name to our combo box. | |||
end | |||
end | |||
) | |||
addCommandHandler ( "clear", | |||
function ( ) | |||
guiComboBoxClear ( vehiclesComboBox ) | |||
end | |||
) | |||
</syntaxhighlight> | |||
</section> | |||
==See Also== | ==See Also== | ||
{{GUI functions}} | {{GUI functions}} | ||
[[Category:Needs_Example]] | [[Category:Needs_Example]] |
Revision as of 00:23, 27 March 2012
This function removes all the items from a combobox.
Syntax
bool guiComboBoxClear ( element comboBox )
Required Arguments
- comboBox: The combobox element to be cleared
Returns
Returns true if the combobox element is valid and has been cleared successfully, false otherwise.
Example
Click to collapse [-]
ClientThis example creates a combo box with all server vehicles on it, with a command to clear the combo box.
addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) vehiclesComboBox = guiCreateComboBox ( 400, 100, 200, 5 * #getElementsByType ( "vehicle" ), "", false ) -- We create a combo box. for index, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do -- We loop through all vehicles. guiComboBoxAddItem ( vehiclesComboBox, getVehicleName ( vehicle ) ) -- We add the vehicle name to our combo box. end end ) addCommandHandler ( "clear", function ( ) guiComboBoxClear ( vehiclesComboBox ) 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