GuiLabelSetColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
m (Added OOP Method + Counterpart Information)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__  
{{Client function}}
__NOTOC__
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
This function allows you to set the color of a GUI label.
This function allows you to set the color of a GUI label.
Line 8: Line 9:
bool guiLabelSetColor ( element theElement, int red, int green, int blue )
bool guiLabelSetColor ( element theElement, int red, int green, int blue )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[Element/GUI/Text label|GuiLabel]]:setColor||guiLabelGetColor}}


===Required Arguments===  
===Required Arguments===  
Line 18: Line 20:
===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns ''true'' if the function is successful, ''false'' otherwise.
Returns ''true'' if the the color of the gui label was successfully changed, ''false'' otherwise.


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example creates a label with text "Hello World!" and sets it to a random color.
This example does...
<syntaxhighlight lang="lua">local myLabel = guiCreateLabel ( 0.45, 0.48, 0.2, 0.5, "Hello world", true )
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
guiLabelSetColor ( myLabel, math.random(0, 255), math.random(0, 255), math.random(0, 255) )</syntaxhighlight>
<syntaxhighlight lang="lua">
--This line does...
blabhalbalhb --abababa
--This line does this...
mooo
</syntaxhighlight>


==See Also==
==See Also==
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{GUI_functions}}
{{GUI_functions}}
[[Category:Incomplete]]
{{GUI_events}}

Latest revision as of 11:41, 7 August 2019

This function allows you to set the color of a GUI label.

Syntax

bool guiLabelSetColor ( element theElement, int red, int green, int blue )

OOP Syntax Help! I don't understand this!

Method: GuiLabel:setColor(...)
Counterpart: guiLabelGetColor


Required Arguments

  • theElement: The label to be changed.
  • red: An integer specifying the amount of red (0 to 255).
  • green: An integer specifying the amount of green (0 to 255).
  • blue: An integer specifying the amount of blue (0 to 255).

Returns

Returns true if the the color of the gui label was successfully changed, false otherwise.

Example

This example creates a label with text "Hello World!" and sets it to a random color.

local myLabel = guiCreateLabel ( 0.45, 0.48, 0.2, 0.5, "Hello world", true )
guiLabelSetColor ( myLabel, math.random(0, 255), math.random(0, 255), math.random(0, 255) )

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

Input

GUI