DgsGridListRemoveColumn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dgsDxGridListRemoveColumn ( element gridList, int columnIndex )
bool dgsGridListRemoveColumn ( element gridList, int columnIndex )
</syntaxhighlight>  
</syntaxhighlight>  


Line 21: Line 21:


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


function clientsideResourceStart ()
function clientsideResourceStart ()
--Create a gridlist
--Create a gridlist
myGridList = DGS:dgsDxCreateGridList ( 0.30, 0.10, 0.5, 0.60, true )  
myGridList = DGS:dgsCreateGridList ( 0.30, 0.10, 0.5, 0.60, true )  
--Create 4 columns for myGridList
--Create 4 columns for myGridList
columnA = DGS:dgsDxGridListAddColumn ( myGridList, "columnA Title", 0.25 )  
columnA = DGS:dgsGridListAddColumn ( myGridList, "columnA Title", 0.25 )  
columnB = DGS:dgsDxGridListAddColumn ( myGridList, "columnB Title", 0.25 )
columnB = DGS:dgsGridListAddColumn ( myGridList, "columnB Title", 0.25 )
columnC = DGS:dgsDxGridListAddColumn ( myGridList, "columnC Title", 0.25 )
columnC = DGS:dgsGridListAddColumn ( myGridList, "columnC Title", 0.25 )
columnD = DGS:dgsDxGridListAddColumn ( myGridList, "columnD Title", 0.25 )
columnD = DGS:dgsGridListAddColumn ( myGridList, "columnD Title", 0.25 )
   --Set a timer to trigger the deleteColumn function 3 seconds after the script starts
   --Set a timer to trigger the deleteColumn function 3 seconds after the script starts
setTimer ( deleteColumn, 3000, 1 )
setTimer ( deleteColumn, 3000, 1 )

Latest revision as of 13:44, 18 January 2018

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

Syntax

bool dgsGridListRemoveColumn ( element gridList, int columnIndex )

Required Arguments

  • gridList: The dgs grid list you want to remove a column from
  • columnIndex: Column ID

Returns

Returns true if the dgs 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.

DGS = exports.dgs

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" )
		DGS:dgsGridListRemoveColumn ( myGridList, columnA )
	elseif randomDeletion == 2 then    
		outputChatBox ( "Removing column B" )
		DGS:dgsGridListRemoveColumn ( myGridList, columnB )
	elseif randomDeletion == 3 then
		outputChatBox ( "Removing column C" )
		DGS:dgsGridListRemoveColumn ( myGridList, columnC )
	else
		outputChatBox ( "Removing column D" )
		DGS:dgsGridListRemoveColumn ( myGridList, columnD )
	end
end

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

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips