GuiGridListClear

From Multi Theft Auto: Wiki
Revision as of 17:47, 22 December 2022 by Tails (talk | contribs) (→‎Example)
Jump to navigation Jump to search

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

Example 1: 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

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows

Input

GUI