Overview

ComboBox Widget with Alternate Value

<altcombobox />
Available clientside.
Widget is a container.
Extends: combobox

Example: altitem selected.

Example: altitem not selected.
The AltComboBox is used to make a normal selection with a ComboBox but with a special list item that shows an alternate widget and uses this widget for input. The AltComboBox contains <item> tags in the same way as the ComboBox, but may also contain an <altitem> tag which can again contain widgets.

Attributes

value
[altitem] The value of the item. This will be the value of the AltComboBox if this item is selected.
caption
[altitem] The caption of this item. This is the text presented to the user in the ComboBox.
layout
[altitem] The layout of the altitem. Can be one of 'hbox' or 'vbox'.
innerwidget
[altitem] The name of the widget that will produce the AltComboBox value if the altitem is selected.

Attributes inherited from combobox:

type
The selection method of the ComboBox. Can be one 'select', where the user can select items using either the mouse or the arrow keys, 'edit', where the user can write freely in the ComboBox in the same way as in a LineEdit during which it will present but not limit to the matching values of its list, and finally 'search', where the user can write in the ComboBox but is restricted to writing strings matching the items in the list.
value
[item] The value of the item. This will be the value of the ComboBox if this item is selected.
caption
[item] The caption of this item. This is the text presented to the user in the ComboBox.

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 combobox:

nil clear()
This method removes all items from the combobox.
nil addItem(string caption, string value)
This method adds an item to the selectionlist of the combobox.
caption
The item text to be added. It will be added both as the value and caption of the item.
value
The item value. This value is optional. If left out, the caption will be used as the item value.
string lineEditValue()
This method is used to get the value from the combobox lineedit (in case it is in edit mode).
Returns a string containing the current value of the combobox lineedit.
nil setLineEditValue(string text)
This method is used to set the value of the combobox lineedit (in case it is in edit mode).
text
The text string to be set.

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.