Squirrel/Client/Functions/GUIButton/Colour

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m (fail title)
(Added example)
 
Line 13: Line 13:
 
== Example 1. Returning ==
 
== Example 1. Returning ==
  
{{Squirrel/NeedsExample}}
+
This code will message the player with the RGB values of a button when they click on one.
Some explanation here
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onClientClickButton( button )
 +
{
 +
    Message( "R: " + button.Colour.r );
 +
    Message( "G: " + button.Colour.g );
 +
    Message( "B: " + button.Colour.b );
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.
+
The event [[Squirrel/Client/Events/GUI/onClientClickButton|onClientClickButton]] and function [[Squirrel/Client/Functions/Messages/Message|Message]] were used in this example. More information can be found on their corresponding pages.
  
 
== Example 2. Setting ==
 
== Example 2. Setting ==
  
{{Squirrel/NeedsExample}}
+
This code will make a button absolutely blue when clicked on.
Some explanation here too
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onClientClickButton( button )
 +
{
 +
    button.Colour = Colour(0, 0, 255);
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.
+
The event [[Squirrel/Client/Events/GUI/onClientClickButton|onClientClickButton]] and script type [[Squirrel/Script_Types/Colour|Colour]] were used in this example. More information can be found on their corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Client/Functions/GUIButton}}
 
{{Squirrel/Client/Functions/GUIButton}}

Latest revision as of 23:07, 2 August 2011

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This member variable sets/returns the colour of the button.

[edit] Syntax

  1. Colour GUIButton.Colour
  1. GUIButton.Colour = Colour col

[edit] Arguments

  • col - This is a Colour class object

[edit] Example 1. Returning

This code will message the player with the RGB values of a button when they click on one.

  1.  
  2. function onClientClickButton( button )
  3. {
  4. Message( "R: " + button.Colour.r );
  5. Message( "G: " + button.Colour.g );
  6. Message( "B: " + button.Colour.b );
  7. }
  8.  

[edit] Notes

The event onClientClickButton and function Message were used in this example. More information can be found on their corresponding pages.

[edit] Example 2. Setting

This code will make a button absolutely blue when clicked on.

  1.  
  2. function onClientClickButton( button )
  3. {
  4. button.Colour = Colour(0, 0, 255);
  5. }
  6.  

[edit] Notes

The event onClientClickButton and script type Colour were used in this example. More information can be found on their corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox