DgsGridListGetRowCount

From Multi Theft Auto: Wiki

This function returns the number of rows in a dgs grid list.

Syntax

int dgsGridListGetRowCount ( element gridList )

Required Arguments

  • gridList: The dgs grid list to get the number of rows from.

Returns

Returns the number of rows if the function is successful, false otherwise.

Example

This example creates a dgs grid list, fills it with the names of the connected players and prints the number of rows (players) in the chatbox.

DGS = exports.dgs
function clientsideResourceStart ()
        -- Create the dgs grid list element
        local playerList = DGS:dgsCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) 
        -- Create a players column in the list
        local column = DGS:dgsGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then -- If the column was successfully created
                --Loop through adding players to the grid list
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = DGS:dgsGridListAddRow ( playerList )
                        DGS:dgsGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ) )
                end
                outputChatBox ( "Number of player list rows: " .. DGS:dgsGridListGetRowCount ( playerList ) )
        end
end
addEventHandler ( "onClientResourceStart", getResourceRootElement(), clientsideResourceStart )

See Also

Multi Language Supports

Animation

3D Interface

3D Text

Arrow List

Browser

Button

Check Box

Combo Box

Edit

Ellipse Detect Area

Detect Area

Grid List

Image

Memo

Label

Progress Bar

Radio Button

Scroll Bar

Scroll Pane

Switch Button

Tab Panel

Window

Plugin

Media Browser

Rounded Rectangle

Color Picker

Blur Box

Effect 3D