DgsGridListSetColumnTextColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} __NOTOC__ This function changes the color of a gridlist column title. ==Syntax== <syntaxhighlight lang="lua"> bool dgsGridListSetItemColor ( element gridList, int columnIndex, int/table color ) </syntaxhighlight> ===Required Arguments=== *'''gridList:''' The dgs grid list element. *'''columnIndex:''' Column index. *'''color:''' The color of the text. ==Syntax== <syntaxhighlight lang="lua"> bool dgsGridListSetItemColor ( element gridList, int c...")
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dgsGridListSetItemColor ( element gridList, int columnIndex, int/table color )
bool dgsGridListSetColumnTextColor( element gridList, int columnIndex, int color )
</syntaxhighlight>  
</syntaxhighlight>  


Line 15: Line 15:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dgsGridListSetItemColor ( element gridList, int columnIndex, int r, int g, int b [, int a = 255 ] )
bool dgsGridListSetColumnTextColor( element gridList, int columnIndex, int r, int g, int b [, int a = 255 ] )
</syntaxhighlight>  
</syntaxhighlight>  



Latest revision as of 10:08, 17 January 2023

This function changes the color of a gridlist column title.

Syntax

bool dgsGridListSetColumnTextColor( element gridList, int columnIndex, int color )

Required Arguments

  • gridList: The dgs grid list element.
  • columnIndex: Column index.
  • color: The color of the text.

Syntax

bool dgsGridListSetColumnTextColor( element gridList, int columnIndex, int r, int g, int b [, int a = 255 ] )

Required Arguments

  • gridList: The dgs grid list element.
  • columnIndex: Column index.
  • r: The amount of red in the color (0-255).
  • g: The amount of green in the color (0-255).
  • b: The amount of blue in the color (0-255).

Optional Arguments

  • a: The amount of alpha in the color (0-255).

Returns

Returns true if the title color was set successfully, false otherwise.

Example

example 1

Click to collapse [-]
Client
loadstring(exports.dgs:dgsImportFunction())()
function createGridList()
    local gridlist = dgsCreateGridList(0.3, 0.3, 0.4, 0.4, true)
    dgsGridListAddColumn(gridlist, "Column 1", 0.25)
    dgsGridListSetColumnTextColor(gridlist, 1, tocolor(255, 0, 0))

    dgsGridListAddColumn(gridlist, "Column 2", 0.25)
    dgsGridListSetColumnTextColor(gridlist, 2, tocolor(0, 255, 0))

    dgsGridListAddColumn(gridlist, "Column 3", 0.25)
    dgsGridListSetColumnTextColor(gridlist, 3, tocolor(0, 0, 255))

    dgsGridListAddColumn(gridlist, "Column 4", 0.25)
    dgsGridListSetColumnTextColor(gridlist, 4, tocolor(255, 255, 0))

    for i = 1, 100 do
        local row = dgsGridListAddRow(gridlist)
        dgsGridListSetItemText(gridlist, row, 1, "Row " .. i)
        dgsGridListSetItemText(gridlist, row, 2, "Row " .. i)
        dgsGridListSetItemText(gridlist, row, 3, "Row " .. i)
        dgsGridListSetItemText(gridlist, row, 4, "Row " .. i)
    end
end
createGridList()

example 2

Click to collapse [-]
Client
loadstring(exports.dgs:dgsImportFunction())()
function createGridList()
    -- create 3 columns and change their colors. then create 100 rows
    local gridlist = dgsCreateGridList(0.3, 0.3, 0.4, 0.4, true)
    dgsGridListAddColumn(gridlist, "Column 1", 0.25)
    dgsGridListSetColumnTextColor(gridlist, 1, 255, 0, 0)

    dgsGridListAddColumn(gridlist, "Column 2", 0.25)
    dgsGridListSetColumnTextColor(gridlist, 2, 0, 255, 0)

    dgsGridListAddColumn(gridlist, "Column 3", 0.25)
    dgsGridListSetColumnTextColor(gridlist, 3, 0, 0, 255)

    dgsGridListAddColumn(gridlist, "Column 4", 0.25)
    dgsGridListSetColumnTextColor(gridlist, 4, 255, 255, 0, 180)

    for i = 1, 100 do
        local row = dgsGridListAddRow(gridlist)
        dgsGridListSetItemText(gridlist, row, 1, "Row " .. i)
        dgsGridListSetItemText(gridlist, row, 2, "Row " .. i)
        dgsGridListSetItemText(gridlist, row, 3, "Row " .. i)
        dgsGridListSetItemText(gridlist, row, 4, "Row " .. i)
    end
end
createGridList()

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