DgsGridListGetRowCount

From Multi Theft Auto: Wiki
(Redirected from DgsDxGridListGetRowCount)
Jump to navigation Jump to search

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

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