GuiGridListRemoveRow: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
This allows you to delete rows that exist in grid lists.
This fake function is for use with blah & blah and does blahblahblabhalbhl


==Syntax==  
==Syntax==  
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool guiGridListRemoveRow ( element gridList, int rowIndex )
bool guiGridListRemoveRow ( element gridList, int rowIndex )
Line 10: Line 8:


===Required Arguments===  
===Required Arguments===  
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
*'''gridList:''' The grid list you want to add a column to
*'''argumentName:''' description
*'''rowIndex:''' Row ID
 
<!-- Only include this section below if there are optional arguments -->
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' description
*'''argumentName3:''' description


===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns ''true'' if the grid list row was successfully removed, ''false'' otherwise.
Returns ''true'' if blah, ''false'' otherwise.


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
In this example, when the script starts, a grid list with 1 column and 2 rows, which have text assigned to them. After 3 seconds, one row is randomly deleted.
This example does...
 
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">function deleteRow ()
<syntaxhighlight lang="lua">
        --Choose randomly which row to delete, output the
--This line does...
        --chosen row into the chat box, and delete the row
blabhalbalhb --abababa
    randomDeletion = math.random ( 1, 2 ) 
--This line does this...
if randomDeletion == 1 then
mooo
outputChatBox ( "Removing row A" )
</syntaxhighlight>
guiGridListRemoveRow ( myGridList, rowA )
elseif randomDeletion == 2 then   
    outputChatBox ( "Removing row B" )
guiGridListRemoveRow ( myGridList, rowB )
end
end
 
 
function clientsideResourceStart ()
--Create a gridlist
    myGridList = guiCreateGridList ( 0.30, 0.10, 0.5, 0.60, true )
    --Create a column for myGridList to add rows into
columnA = guiGridListAddColumn ( myGridList, "columnA Title", 0.25 )
    rowA = guiGridListAddRow ( myGridList )
    guiGridListSetItemText ( myGridList, rowA, columnA, "Hello", false, false )
    rowB = guiGridListAddRow ( myGridList )
    guiGridListSetItemText ( myGridList, rowB, columnA, "World!", false, false )
      --Trigger the function to delete a row 3 seconds after the script starts
setTimer ( deleteRow, 3000, 1 )
end
addEventHandler ( "onClientResourceStart", getRootElement(), clientsideResourceStart )</syntaxhighlight>


==See Also==
==See Also==
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{GUI functions}}
{{GUI functions}}
[[Category:Incomplete]]

Revision as of 07:29, 9 October 2007

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

Syntax

bool guiGridListRemoveRow ( element gridList, int rowIndex )

Required Arguments

  • gridList: The grid list you want to add a column to
  • rowIndex: Row ID

Returns

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

Example

In this example, when the script starts, a grid list with 1 column and 2 rows, which have text assigned to them. After 3 seconds, one row is randomly deleted.

function deleteRow ()
        --Choose randomly which row to delete, output the
        --chosen row into the chat box, and delete the row
    	randomDeletion = math.random ( 1, 2 )   
		if randomDeletion == 1 then
			outputChatBox ( "Removing row A" )
			guiGridListRemoveRow ( myGridList, rowA )
		elseif randomDeletion == 2 then    
		    outputChatBox ( "Removing row B" )
			guiGridListRemoveRow ( myGridList, rowB )
		end
end


function clientsideResourceStart ()
		--Create a gridlist
    	myGridList = guiCreateGridList ( 0.30, 0.10, 0.5, 0.60, true ) 
    	--Create a column for myGridList to add rows into
		columnA = guiGridListAddColumn ( myGridList, "columnA Title", 0.25 ) 
	    rowA = guiGridListAddRow ( myGridList )
	    guiGridListSetItemText ( myGridList, rowA, columnA, "Hello", false, false )
	    rowB = guiGridListAddRow ( myGridList )
	    guiGridListSetItemText ( myGridList, rowB, columnA, "World!", false, false )
   	    --Trigger the function to delete a row 3 seconds after the script starts
		setTimer ( deleteRow, 3000, 1 )
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