Overview

Meta Widget

<metawidget />
Available clientside.
Widget is a container.
Extends: widget

An example of a metawidget with two inner widgets. The metawidget is not in itself visible.
This widget is simply a container compositing its value from the widgets within it. The value of the widget cannot be set and its value attribute is therefore ignored.
An example of how to use metawidget with two inner widgets:
<metawidget layout="vbox" name="dims" storechildren="true"
            format="return widget('test1'):value() .. ': ' .. widget('test2'):value()">
  <lineedit name="test1" value="test"/>
  <checkbox name="test2" value="ja" truevalue="ja" falsevalue="nej"
            caption="Og svaret er?"/>
</metawidget>

Attributes

layout
the layout of the widget. Can be one of 'vbox' or 'hbox'.
storechildren
This attribute indicates wether the child widgets should be stored on macro commit. It can be either 'true' or 'false'.
format
This attribute contains lua code. The return value of the code is the resulting value of the meta widget.
layout
The layout assigned to the widget. Can be one of 'hbox' or 'vbox'.

Attributes inherited from widget:

name
The name of the widget. This is also the name used by the scripts.
value
The initial value of the widget. It is overwritten if there is a map with a recent value or if the database contains a recent value.
onChange
Change event script callback. This attribute contains script code that are executed each time the widget is changed.
onInit
Init event script callback. This attribute contains script code that are executed when the widget has just been created.
map
This attribute binds the value of the widget to a map.
width
Use this attribute to set the width of the widget to a fixed value.
height
Use this attribute to set the height of the widget to a fixed value.
help
This attribute contains a help text for this widget. It will be shown to the user when the mouse is hovering over the widget.
local
This attribute is a boolean telling wether the field can be stored in the database on commits. It can be either 'true' or 'false'. The default is 'false'.
colour
The foreground (text) colour of the widget. The value must be a 6 byte hexadecimal string with each 2 byte pair describing the colour channels in order: Red, green blue. Example: '0f1a3b'.
bgcolour
The background colour of the widget. The value must be a 6 byte hexadecimal string with each 2 byte pair describing the colour channels in order: Red, green blue. Example: '0f1a3b'.

Method overview

Methods

Methods inherited from widget:

string name()
This method is used to get the name of the widget. This name is the same as the one specified in the name attribute.
Returns a string containing the name of the widget.
string type()
This method is used to get the type of the widget. This type is the same as the widget tagname and can be used by script to verify the type before calling any type specific methods.
Returns a string containing the type of the widget.
string value()
This method is used to get the current value of the widget.
Returns a string containing the value of the widget.
nil setValue(string value)
This method is used to set the value of the widget.
value
A string containing the value to set.
boolean enabled()
This method is used to get the current enable state of the widget.
Returns a boolean value. If the widget is enabled the method returns true otherwise it returns false.
nil setEnabled(boolean enabled)
This method is used to either enable (make editable) or disable (grey out) the widget. NOTE: A disabled widget will not supply its value to the server during a commit.
enabled
A boolean value. If true the widget is enabled. If false the widget is disabled.
boolean visible()
This method is used to get the current visibility state of the widget.
Returns a boolean value. If the widget is visible the method returns true otherwise it returns false.
nil setVisible(boolean visible)
This method is used to either show or hide the widget. The widget will take up an equal amount of layout space regardless of its visibility state meaning that the layout will remain static after a hiding/showing of the widget. NOTE: An invisble widget will not supply its value to the server during a commit.
visible
A boolean value. If true the widget is shown. If false the widget is hidden.
boolean hidden()
This method is used to get the current hide state of the widget.
Returns a boolean value. If the widget is hidden the method returns true otherwise it returns false.
nil setHidden(boolean hidden)
This method is used to either show or hide the widget, collapsing the occupied space. NOTE: A hidden widget will not supply its value to the server during a commit.
hidden
A boolean value. If true the widget is hidden. If false the widget is shown.
boolean valid()
This method is used to get the current validity state of the widget. See also setValid().
Returns a boolean value. If the widget is valid the method returns true otherwise it returns false.
nil setValid(boolean valid)
This method is used to set the widgets validity state. Most widgets have a visual indication of their validity state (a red background colour for example) and this will also be set using this method. See also valid(). NOTE: An invalid widget that are not an inner widget will block a server commit.
valid
A boolean value. If true the widgets validity state is set to 'valid'. If false the widgets validity state is set to 'invalid'.
nil setBackgroundColour(integer red, integer green, integer blue)
This method is used to change to background colour of the widget.
red
An integer value in the range 0-255. This is the red component of the RGB colour value.
green
An integer value in the range 0-255. This is the green component of the RGB colour value.
blue
An integer value in the range 0-255. This is the blue component of the RGB colour value.
nil setForegroundColour(integer red, integer green, integer blue)
This method is used to change to foreground (text) colour of the widget.
red
An integer value in the range 0-255. This is the red component of the RGB colour value.
green
An integer value in the range 0-255. This is the green component of the RGB colour value.
blue
An integer value in the range 0-255. This is the blue component of the RGB colour value.