DgsGridListGetSelectedCount: 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">
int guiGridListGetSelectedCount ( element gridList [, int inRow = -1, int inColumn = -1 ] )
int dgsGridListGetSelectedCount ( element gridList [, int inRow = -1, int inColumn = -1 ] )
</syntaxhighlight>
</syntaxhighlight>


Line 37: Line 37:
==See Also==
==See Also==
{{DGSFUNCTIONS}}
{{DGSFUNCTIONS}}
{{DGSEVENTS}}

Latest revision as of 08:33, 17 January 2021

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

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