Style

structure Style

This object represents the style of a widget. Styles can be either changed directly on a Widget, or changed on the GUI:SKIN so as to affect all subsequently created widgets of a particular type inside that GUI.

Suffix Type Description
HSTRETCH Boolean Should the widget stretch horizontally? (default depends on widget subclass)
VSTRETCH Boolean Should the widget stretch vertically?
WIDTH scalar (pixels) Fixed width (or 0 if flexible).
HEIGHT scalar (pixels) Fixed height (or 0 if flexible).
MARGIN StyleRectOffset Spacing between this and other widgets.
PADDING StyleRectOffset Spacing between the outside of the widget and its contents (text, etc.).
BORDER StyleRectOffset Size of the edges in the 9-slice image for BG images in NORMAL, HOVER, etc.
OVERFLOW StyleRectOffset Extra space added to the area of the background image. Allows the background to go beyond the widget’s rectangle.
ALIGN string One of “CENTER”, “LEFT”, or “RIGHT”. See note below.
FONT string The name of the font of the text on the content or “” if the default.
FONTSIZE scalar The size of the text on the content.
RICHTEXT Boolean Set to False to disable rich-text (<i>...</i>, etc.)
NORMAL StyleState Properties for the widget normally.
ON StyleState Properties for when the widget is under the mouse and “on”.
NORMAL_ON StyleState Alias for ON.
HOVER StyleState Properties for when the widget is under the mouse.
HOVER_ON StyleState Properties for when the widget is under the mouse and “on”.
ACTIVE StyleState Properties for when the widget is active (eg. button being held down).
ACTIVE_ON StyleState Properties for when the widget is active and “on”.
FOCUSED StyleState Properties for when the widget has keyboard focus.
FOCUSED_ON StyleState Properties for when the widget has keyboard focus and is “on”.
BG string The same as NORMAL:BG. Name of a “9-slice” image file.
TEXTCOLOR Color The same as NORMAL:TEXTCOLOR. The color of the text on the label.
Style:HSTRETCH
Type:Boolean
Access:Get/Set

Should the widget stretch horizontally? (default depends on widget subclass)

Style:VSTRETCH
Type:Boolean
Access:Get/Set

Should the widget stretch vertically?

Style:WIDTH
Type:scalar
Access:Get/Set

(pixels) Fixed width (or 0 if flexible).

Style:HEIGHT
Type:scalar
Access:Get/Set

(pixels) Fixed height (or 0 if flexible).

Style:MARGIN
Type:StyleRectOffset
Access:Get/Set

Spacing between this and other widgets.

Style:PADDING
Type:StyleRectOffset
Access:Get/Set

Spacing between the outside of the widget and its contents (text, etc.).

Style:BORDER
Type:StyleRectOffset
Access:Get/Set

Size of the edges in the 9-slice image for BG images in NORMAL, HOVER, etc.

Style:OVERFLOW
Type:StyleRectOffset
Access:Get/Set

Extra space added to the area of the background image. Allows the background to go beyond the widget’s rectangle.

Style:ALIGN
Type:string
Access:Get/Set

One of “CENTER”, “LEFT”, or “RIGHT”.

Note

The ALIGN attribute will not do anything useful unless either HSTRETCH is set to true or a fixed WIDTH is set, since otherwise it will be exactly the right size to fit the content of the widget with no alignment within that space being necessary.

It is currently only relevant for the widgets that have scalar content (Label and subclasses).

Style:FONT
Type:string
Access:Get/Set

The name of the font of the text on the content or “” if the default.

Style:FONTSIZE
Type:scalar
Access:Get/Set

The size of the text on the content.

Style:RICHTEXT
Type:Boolean
Access:Get/Set

Set to False to disable rich-text (<i>...</i>, etc.)

Style:NORMAL
Type:StyleState
Access:Get/Set

Properties for the widget normally.

Style:ON
Type:StyleState
Access:Get/Set

Properties for when the widget is under the mouse and “on”.

Style:NORMAL_ON
Type:StyleState
Access:Get/Set

Alias for ON.

Style:HOVER
Type:StyleState
Access:Get/Set

Properties for when the widget is under the mouse.

Style:HOVER_ON
Type:StyleState
Access:Get/Set

Properties for when the widget is under the mouse and “on”.

Style:ACTIVE
Type:StyleState
Access:Get/Set

Properties for when the widget is active (eg. button being held down).

Style:ACTIVE_ON
Type:StyleState
Access:Get/Set

Properties for when the widget is active and “on”.

Style:FOCUSED
Type:StyleState
Access:Get/Set

Properties for when the widget has keyboard focus.

Style:FOCUSED_ON
Type:StyleState
Access:Get/Set

Properties for when the widget has keyboard focus and is “on”.

Style:BG
Type:string
Access:Get/Set

The same as NORMAL:BG. Name of a “9-slice” image file.

Style:TEXTCOLOR
Type:color

The same as NORMAL:TEXTCOLOR. The color of the text on the label.