Torque 3D - Script Manual: GuiSwatchButtonCtrl Class Reference

TorqueScript

Main   Class List   Namespace List   Online

GuiSwatchButtonCtrl Class Reference
[Button Controls]

A button that is used to represent color; often used in correlation with a color picker. More...

Inheritance diagram for GuiSwatchButtonCtrl:

List of all members.

Public Member Functions

void setColor (string newColor)
 Set the color of the swatch control.

Public Attributes

ColorF color
 The foreground color of GuiSwatchButtonCtrl.

Detailed Description

A button that is used to represent color; often used in correlation with a color picker.

A swatch button is a push button that uses its color field to designate the color drawn over an image, on top of a button.

The color itself is a float value stored inside the GuiSwatchButtonCtrl::color field. The texture path that represents the image underlying the color is stored inside the GuiSwatchButtonCtrl::bitmap field. The default value assigned toGuiSwatchButtonCtrl::color is "1 1 1 1"( White ). The default/fallback image assigned to GuiSwatchButtonCtrl::bitmap is "core/art/gui/images/transp_grid".

Example:
// Create a GuiSwatchButtonCtrl that calls randomFunction with its current color when clicked
%swatchButton = new GuiSwatchButtonCtrl()
{
   profile = "GuiInspectorSwatchButtonProfile";
   command = "randomFunction( $ThisControl.color );";
};

Member Function Documentation

void GuiSwatchButtonCtrl::setColor ( string  newColor  ) 

Set the color of the swatch control.

Parameters:
newColor The new color string given to the swatch control in float format "r g b a".
Note:
It's also important to note that when setColor is called causes the control's altCommand field to be executed.

Member Data Documentation

The foreground color of GuiSwatchButtonCtrl.



Copyright © GarageGames, LLC. All Rights Reserved.