GuiGridListClear: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(OOP syntax)
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__  
{{Client function}}
This function clears out all the data from a GUI grid list element
__NOTOC__
This function clears all the data from a grid list.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool guiGridListClear ( element gridList )
bool guiGridListClear ( element gridList )
</syntaxhighlight>  
</syntaxhighlight>
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:clear}}


===Required Arguments===  
===Required Arguments===  
Line 11: Line 13:


===Returns===
===Returns===
Returns ''true'' if the grid list element is valid and it has been cleared successfully, ''false'' otherwise.
Returns ''true'' if the grid list element is valid and has been cleared successfully, ''false'' otherwise.


==Example==  
==Example==  
This example creates a grid list, puts a "Hello world" text in and clears it in 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 ()
function test ()
        -- Create the grid list element
--Create the grid list element
local testList = guiCreateGridList ( 0.45, 0.45, 0.15, 0.15, true )  
local testList = guiCreateGridList ( 0.45, 0.45, 0.10, 0.10, true )
        -- 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
local column = guiGridListAddColumn( testList, "test", 0.85 )  
local column = guiGridListAddColumn( testList, "test", 0.85 )
guiGridListSetItemText ( testList, guiGridListAddRow ( testList ), column, "Hello", false, false )
guiGridListSetItemText ( testList, guiGridListAddRow ( testList ), column, "Hello World", false, false )
guiGridListSetItemText ( testList, guiGridListAddRow ( testList ), column, "World", false, false )
--Set a timer to clear the grid list in 5 seconds
        -- Set a timer to call the guiGridListClear function to clear the grid list items in 5 seconds
setTimer ( guiGridListClear, 5000, 1, testList )
setTimer ( guiGridListClear, 5000, 1, testList )  
end
end
</syntaxhighlight>
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )</syntaxhighlight>


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

Revision as of 21:08, 7 November 2018

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

Input

GUI