DgsGridListGetSelectedCount

From Multi Theft Auto: Wiki

This function returns the amount of options selected in the specified dgs grid list.

Syntax

int guiGridListGetSelectedCount ( element gridList [, int inRow = -1, int inColumn = -1 ] )

Required Arguments

  • gridList: The dgs grid list whose amount of selected items you want to retrieve.

Optional Arguments

  • inRow: An integer of the index of the specific row ( used to get the count of items from the specific row ).
  • inColumn: An integer of the index of the specific column ( used to get the count of items from the specific column ).

Returns

Returns an integer representing the amount of selected options if everything was successful or false if invalid arguments were passed.

Example

This example creates a gridlist filled with players names then check who has the letter "a" in their name, after it selects everyone who has the letter "a" then it outputs the selected rows.

DGS = exports.dgs
gridlist = DGS:dgsCreateGridList(100,100,200,100,false)
DGS:dgsGridListAddColumn(gridlist,"Players",0.50)
for i,v in ipairs(getElementsByType("player"))do
	DGS:dgsGridListAddRow(gridlist,_,getPlayerName(v))
end
for b=0, DGS:dgsGridListGetRowCount(gridlist)do
	if(string.find(DGS:dgsGridListGetItemText(gridlist,b,1),"a",1,true))then
		DGS:dgsGridListSetSelectedItem(gridlist,b,1)
	end
end
outputChatBox("The number of Players with 'a' in their name: "..DGS:dgsGridListGetSelectedCount(gridlist)..".")

See Also

Multi Language Supports

Animation

3D Interface

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Grid List

Image

Memo

Label

Progress Bar

Radio Button

Scroll Bar

Scroll Pane

Selector

Switch Button

Tab Panel

Window

Plugin

Blur Box

Color Picker

Canvas

Effect 3D

Media Browser

Mask

Nine Slice

Object Preview Supports

QRCode

Remote Image

Rounded Rectangle