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

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