DgsGridListGetRowCount: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} __NOTOC__ This function returns the number of rows in a dgs grid list. ==Syntax== <syntaxhighlight lang="lua"> int dgsDxGridListGetRowCount ( element gri...")
 
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int dgsDxGridListGetRowCount ( element gridList )
int dgsGridListGetRowCount ( element gridList )
</syntaxhighlight>  
</syntaxhighlight>  


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

Latest revision as of 13:46, 18 January 2018

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