GuiGridListClear: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:


==Example==  
==Example==  
This example creates a grid list, puts an item with the text "Hello world" in it and clears the grid list after 5 seconds.
This example creates a grid list, puts 2 items in to display the text "Hello" and "world" and clears the grid list after 5 seconds.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">function clientsideResourceStart ()
-- Create the grid list element
local testList = guiCreateGridList ( 0.45, 0.45, 0.15, 0.15, true ) -- Create the grid list element
local testList = guiCreateGridList ( 0.45, 0.45, 0.10, 0.10, true )
local column = guiGridListAddColumn( testList, "test", 0.85 ) -- Create a column in the list and add 2 rows displaying "Hello" text and "world" text
-- Create a column in the list and add a row with "Hello world" text
guiGridListSetItemText ( testList, guiGridListAddRow ( testList ), column, "Hello", false, false )
local column = guiGridListAddColumn( testList, "test", 0.85 )
guiGridListSetItemText ( testList, guiGridListAddRow ( testList ), column, "World", false, false )
guiGridListSetItemText ( testList, guiGridListAddRow ( testList ), column, "Hello World", false, false )
setTimer ( guiGridListClear, 5000, 1, testList ) -- Set a timer to call the guiGridListClear function to clear the grid list items in 5 seconds
-- Set a timer to clear the grid list in 5 seconds
end
setTimer ( guiGridListClear, 5000, 1, testList )
addEventHandler ( "onClientResourceStart", getRootElement(), clientsideResourceStart )</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{GUI functions}}
{{GUI functions}}

Revision as of 05:06, 8 October 2007

This function clears all the data from a grid list.

Syntax

bool guiGridListClear ( element gridList )

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 example creates a grid list, puts 2 items in to display the text "Hello" and "world" and clears the grid list after 5 seconds.

function clientsideResourceStart ()
	local testList = guiCreateGridList ( 0.45, 0.45, 0.15, 0.15, true ) -- Create the grid list element
	local column = guiGridListAddColumn( testList, "test", 0.85 ) -- Create a column in the list and add 2 rows displaying "Hello" text and "world" text
	guiGridListSetItemText ( testList, guiGridListAddRow ( testList ), column, "Hello", false, false )
	guiGridListSetItemText ( testList, guiGridListAddRow ( testList ), column, "World", false, false )
	setTimer ( guiGridListClear, 5000, 1, testList ) -- Set a timer to call the guiGridListClear function to clear the grid list items in 5 seconds
end
addEventHandler ( "onClientResourceStart", getRootElement(), clientsideResourceStart )

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