DgsGridListGetSelectedCount

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

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

Syntax

int dgsGridListGetSelectedCount ( 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

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

Plugin

Blur Box

Canvas

Chart

Circle

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Rounded Rectangle

Screen Source

SVG

Tooltips