Text Input Field
Description
A text input field allows the user to enter and edit a single line of text, without length restriction.
The input field can have a label, which will show to the left of the input field and a description, which can span multiple lines. The description is placed above the input field and uses the entire available layout width. The width of the input field must be explicitly set, otherwise it will only accommodate a single character.
To specify a text input field create a <field>
tag and use the type
attribute with a value of text
. The txt
and id
attributes are not supported here. The variable
attribute specifies the variable that should be replaced with the text taken from the input field.
Data
The data consists of two items, a description
and the spec
. The <spec>
tag uses four attributes. The label text is specified with txt
and/or id
as described above. In addition, the width of the input field as it appears on the panel can be set with the size
attribute. The value must be an integer and sets the field width based on the average character width of the active font. If this is not specified, then you will end up with a very narrow field that is practically unusable.
The fourth attribute set
is optional. It takes a text string to pre-fill the input field.
Example
The following example creates a text input field with a label and description. The width of the input field will be enough to accommodate 15 characters. The field will be pre-set with the text 'some text' when the UI is first presented.
<field type="text" variable="textInput">
<description txt="A description for a text input field"
id="description.text"/>
<spec txt="Enter some text:" id="text.label" size="15" set="some text"/>
</field>