DgsLabelGetColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0132|1.3.1|4670| This function gets the color of a label. }} ==Syntax== <syntaxhighlight lang="lua"> int int int dgsDxLabe...")
 
Line 16: Line 16:
===Returns===
===Returns===
If argument 'notSplit' passed true, returns one ''int'' value, representing the color of the label if successful. ''false'' otherwise.
If argument 'notSplit' passed true, returns one ''int'' value, representing the color of the label if successful. ''false'' otherwise.
If argument 'notSplit' passed false, returns three ''int'' values, representing the amount of red, green, blue if successful. ''false'' otherwise.
If argument 'notSplit' passed false, returns three ''int'' values, representing the amount of red, green, blue if successful. ''false'' otherwise.



Revision as of 15:37, 12 June 2017

This function gets the color of a label.

Syntax

int int int dgsDxLabelGetColor ( dgs-element theLabel [, bool notSplit = false ] )

Required Arguments

  • theLabel: The label to get color.
  • notSplit: A bool of whether the color is split into r,g,b,a or not.

Returns

If argument 'notSplit' passed true, returns one int value, representing the color of the label if successful. false otherwise.

If argument 'notSplit' passed false, returns three int values, representing the amount of red, green, blue if successful. false otherwise.

Example

local pLabel = guiCreateLabel( 0.5, 0.5, 0.5, 0.5, 'Text', true )
guiLabelSetColor( pLabel, math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ) )

addCommandHandler( 'get_color_label', 
    function()
        local iR, iG, iB = guiLabelGetColor( pLabel )
        outputChatBox( ( 'Label color is r = %d, g = %d, b = %d' ):format( iR, iG, iB ) )
    end
)

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows