DgsGridListAddColumn

From Multi Theft Auto: Wiki
Revision as of 03:32, 9 August 2017 by Thisdp (talk | contribs) (Created page with "{{Client function}} __NOTOC__ This function is used to create columns in grid lists. ==Syntax== <syntaxhighlight lang="lua"> int dgsDxGridListAddColumn ( element gridList, s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function is used to create columns in grid lists.

Syntax

int dgsDxGridListAddColumn ( element gridList, string title, float width )

Required Arguments

  • gridList: The grid list you want to add a column to
  • title: Title of the column
  • width: Column width, relative to the grid list width

Returns

Returns the column id if it was created, false otherwise.

Example

This example creates a player list on the right side of the screen and fills it with the currently connected players.

DGS = exports.dgs
function clientsideResourceStart ()
        local playerList = DGS:dgsDxCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) -- Create the grid list
        local column = DGS:dgsDxGridListAddColumn( playerList, "Player", 0.85 ) -- Create a 'players' column in the list
        if ( column ) then -- If the column was successfully created
                for id, playeritem in ipairs(getElementsByType("player")) do 
                --Loop through all the players, adding them to the table
                        local row = DGS:dgsDxGridListAddRow ( playerList )
                        DGS:dgsDxGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false )
                end
        end
end
addEventHandler ( "onClientResourceStart", resourceRoot, 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