Module attribute

Widget attributes.

This module defines "attributes" (special fields) that are recognized by all widgets. Their interpretation may vary depending on the type of widget. Some widget types may also recognize additional attributes.

Setting attributes can have side effects. For example, setting height or width causes the parent widget and its descendants to recalculate their size and position.

Widget Attributes

id widget identifier.
key Keyboard accelerator.
value widget value.
style widget style.

Size Attributes

flow Flow axis.
width Width.
height Height.
minwidth Minimum width.
minheight Minimum height.

Font Attributes

font Font path.
size Font size.

Text Attributes

text Text to display.
color Text color.
align Text and icon alignment.
wrap Wrap text onto multiple lines.

Visual Attributes

background Background color.
outline Outline color.
slices Slice image.
margin Margin size.
padding Padding size.
icon Icon path.


Widget Attributes

id
widget identifier.

Should contain a unique string identifying the widget, if present.

A reference to the widget will be stored in the associated layout in a property having the same name as the widget's id.

Setting this attribute re-registers the widget with its layout.

key
Keyboard accelerator.

Should contain a string representing a key and optional modifiers, separated by dashes; for example 'ctrl-c' or 'alt-shift-escape'.

Pressing this key combination bubbles a Press event on the widget, as if it had been pressed with a mouse or touch interface.

Setting this attribute re-registers the widget with its layout.

value
widget value.

Some widget types expect the value to be of a specific type and within a specific range. For example, slider and progress widgets expect a normalized number, and text widgets expect a string.

Setting this attribute bubbles the Change event.

style
widget style.

Should contain a string or array of strings identifying style rules to be applied to the widget. When resolving any attribute with a nil value, these style rules are searched for a corresponding attribute.

Setting this attribute resets the Font and Text object associated with this widget.

Setting this attribute recalculates the size and position of the parent widget and its descendants.

Size Attributes

Setting these attributes recalculates the size and position of the parent widget and its descendants.
flow
Flow axis.

Should equal either 'x' or 'y'. Defaults to 'y'.

This attribute determines the placement and default dimensions of any child widgets.

When flow is 'x', the height of child widgets defaults to this widget's height, and each child is placed to the right of the previous child. When flow is 'y', the width of child widgets defaults to this widget's width, and each child is placed below the previous child.

Setting this attribute resets the Text object associated with this widget.

width
Width.

This attribute may not always hold a numeric value. To get the calculated width, use Widget:getWidth.

Setting this attribute when the wrap attribute is also present resets the Text object associated with this widget.

height
Height.

This attribute may not always hold a numeric value. To get the calculated height, use Widget:getHeight.

minwidth
Minimum width.
minheight
Minimum height.

Font Attributes

Setting these attributes resets the Font and Text objects associated with the widget.
font
Font path.

Should contain a path to a TrueType font to use for displaying this widget's text.

size
Font size.

Should contain a number representing the size of the font, in points. Defaults to 12.

Text Attributes

Setting these attributes resets the Text object associated with the widget.
text
Text to display.
color
Text color.

Should contain an array with 3 or 4 values (RGB or RGBA) from 0 to 255.

align
Text and icon alignment.
wrap
Wrap text onto multiple lines.

Should contain true for multiline text, or false or nil for a single line. Even text containing line breaks will display as a single line when this attribute is not set to true.

Visual Attributes

background
Background color.

Should contain an array with 3 or 4 values (RGB or RGBA) from 0 to 255.

outline
Outline color.

Should contain an array with 3 or 4 values (RGB or RGBA) from 0 to 255.

slices
Slice image.

Should contain a path to an image with "slices" to display for this widget.

margin
Margin size.

The margin area occupies space outside of the outline and slices.

padding
Padding size.

The padding area occupies space inside the outline and slices, and outside the space where the icon and text and any child widgets appear.

icon
Icon path.

Should contain a path to an image file.

generated by LDoc 1.4.3 Last updated 2015-11-29 23:24:00