GuiLabelSetColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 19: Line 19:
===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]]

Revision as of 10:25, 9 October 2007

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

Syntax

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

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