GuiGridListRemoveColumn: 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 columns that exist in grid lists.
This fake function is for use with blah & blah and does blahblahblabhalbhl


==Syntax==  
==Syntax==  
Line 10: Line 9:


===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
*'''columnIndex:''' Column 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 column was successfully removed, ''false'' otherwise.
Returns ''true'' if blah, ''false'' otherwise.


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
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.
This example does...
<syntaxhighlight lang="lua">function deleteColumn ()
<!-- 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 -->
        --Choose randomly which column to delete, output the chosen column into the chat box, and delete the column
<syntaxhighlight lang="lua">
    randomDeletion = math.random ( 1, 4 ) 
--This line does...
if randomDeletion == 1 then
blabhalbalhb --abababa
        outputChatBox ( "Removing column A" )
--This line does this...
        guiGridListRemoveColumn ( myGridList, columnA )
mooo
elseif randomDeletion == 2 then   
        outputChatBox ( "Removing column B" )
        guiGridListRemoveColumn ( myGridList, columnB )
elseif randomDeletion == 3 then
        outputChatBox ( "Removing column C" )
        guiGridListRemoveColumn ( myGridList, columnC )
else
        outputChatBox ( "Removing column D" )
        guiGridListRemoveColumn ( myGridList, columnD )
end
end
 
 
function clientsideResourceStart ()
--Create a gridlist
    myGridList = guiCreateGridList ( 0.30, 0.10, 0.5, 0.60, true )
    --Create 4 columns for myGridList
columnA = guiGridListAddColumn ( myGridList, "columnA Title", 0.25 )
columnB = guiGridListAddColumn ( myGridList, "columnB Title", 0.25 )
columnC = guiGridListAddColumn ( myGridList, "columnC Title", 0.25 )
    columnD = 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", getRootElement(), clientsideResourceStart )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 07:19, 9 October 2007

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

Syntax

bool guiGridListRemoveColumn ( element gridList, int columnIndex )

Required Arguments

  • gridList: The grid list you want to add a column to
  • columnIndex: Column ID

Returns

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

Example

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.

function deleteColumn ()
        --Choose randomly which column to delete, output the chosen column into the chat box, and delete the column
    	randomDeletion = math.random ( 1, 4 )   
		if randomDeletion == 1 then
		        outputChatBox ( "Removing column A" )
		        guiGridListRemoveColumn ( myGridList, columnA )
		elseif randomDeletion == 2 then    
		        outputChatBox ( "Removing column B" )
		        guiGridListRemoveColumn ( myGridList, columnB )
		elseif randomDeletion == 3 then
		        outputChatBox ( "Removing column C" )
		        guiGridListRemoveColumn ( myGridList, columnC )
		else
		        outputChatBox ( "Removing column D" )
		        guiGridListRemoveColumn ( myGridList, columnD )
		end
end


function clientsideResourceStart ()
	--Create a gridlist
    	myGridList = guiCreateGridList ( 0.30, 0.10, 0.5, 0.60, true ) 
    	--Create 4 columns for myGridList
	columnA = guiGridListAddColumn ( myGridList, "columnA Title", 0.25 ) 
	columnB = guiGridListAddColumn ( myGridList, "columnB Title", 0.25 )
	columnC = guiGridListAddColumn ( myGridList, "columnC Title", 0.25 )
    	columnD = 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", 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