guiGridListRemoveColumn | Multi Theft Auto: Wiki Skip to content

guiGridListRemoveColumn

Client-side
Server-side
Shared

Pair: guiGridListAddColumn

This allows you to delete columns that exist in grid lists.

OOP Syntax Help! I don't understand this!

Syntax

bool guiGridListRemoveColumn ( ​gui-gridlist gridList, ​int columnIndex )
Required arguments
  • gridList: The grid list you want to remove a column from.
  • columnIndex: Column ID. Indexes start at 1.

Returns

Returns true if the grid list column was successfully removed, false otherwise.

  • bool: result

Code Examples

client

This example creates a grid list and adds 4 columns to it when the script starts. After 3 seconds, it randomly deletes a column and outputs to the chat box which column was deleted.

local myGridList
function deleteColumn()
-- Choose randomly which column to delete, output the chosen column into the chat box, and delete the column
local randomIndex = math.random(1, 4)
outputChatBox("Removing column "..randomIndex)
guiGridListRemoveColumn(myGridList, randomIndex)
end
function clientsideResourceStart()
-- Create a gridlist
myGridList = guiCreateGridList(0.30, 0.10, 0.5, 0.60, true)
-- Create 4 columns for myGridList
guiGridListAddColumn(myGridList, "columnA Title", 0.25)
guiGridListAddColumn(myGridList, "columnB Title", 0.25)
guiGridListAddColumn(myGridList, "columnC Title", 0.25)
guiGridListAddColumn(myGridList, "columnD Title", 0.25)
-- Set a timer to trigger the deleteColumn function 3 seconds after the script starts
setTimer(deleteColumn, 3000, 1)
end
addEventHandler("onClientResourceStart", resourceRoot, clientsideResourceStart)

See Also

GUI Functions