GuiGridListClear: Difference between revisions
Jump to navigation
Jump to search
(OOP syntax) |
m (→Example) |
||
(One intermediate revision by the same user not shown) | |||
Line 16: | Line 16: | ||
==Example== | ==Example== | ||
This | This creates a player list and then clears it when a button is clicked: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- create the grid list | |||
local playerList = guiCreateGridList(0.80, 0.40, 0.15, 0.35, true) | |||
guiGridListAddColumn(playerList, "#", 0.15) | |||
guiGridListAddColumn(playerList, "Player", 0.75) | |||
-- fill the grid list with player names | |||
for index, player in ipairs(getElementsByType("player")) do | |||
guiGridListAddRow(playerList, index, getPlayerName(player)) | |||
end | end | ||
addEventHandler ( " | |||
-- create a button to clear the grid list | |||
local clearButton = guiCreateButton(0.80, 0.30, 0.15, 0.05, "Clear list", true) | |||
-- when the button is clicked, clear the grid list | |||
addEventHandler("onClientGUIClick", clearButton, function() | |||
guiGridListClear(playerList) | |||
end) | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{GUI functions}} | {{GUI functions}} | ||
{{GUI_events}} | {{GUI_events}} |
Latest revision as of 17:47, 22 December 2022
This function clears all the data from a grid list.
Syntax
bool guiGridListClear ( element gridList )
OOP Syntax Help! I don't understand this!
- Method: GuiGridList:clear(...)
Required Arguments
- gridList: The grid list element to be cleared
Returns
Returns true if the grid list element is valid and has been cleared successfully, false otherwise.
Example
This creates a player list and then clears it when a button is clicked:
-- create the grid list local playerList = guiCreateGridList(0.80, 0.40, 0.15, 0.35, true) guiGridListAddColumn(playerList, "#", 0.15) guiGridListAddColumn(playerList, "Player", 0.75) -- fill the grid list with player names for index, player in ipairs(getElementsByType("player")) do guiGridListAddRow(playerList, index, getPlayerName(player)) end -- create a button to clear the grid list local clearButton = guiCreateButton(0.80, 0.30, 0.15, 0.05, "Clear list", true) -- when the button is clicked, clear the grid list addEventHandler("onClientGUIClick", clearButton, function() guiGridListClear(playerList) 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