II. GUI Basics
Chapter 6. Widgets - Using Widgets to Create Interfaces
Edit
setAlphaNumeric
setNumeric
setLabelLength
setPassword
Edit Widget. Edit is a text entry field.
XML Element Name
- <Edit/>
Example
See how edit widget with defult settings appears.
- <Widget setSize="200,100">
- <Edit/>
- </Widget>

Once we start typing in the Edit, the focus is gained:
Edit's properties
Basic set of methods that applies to all widgets is described in the Chapter 9 for widgets styles, and Chapter 10
for widgets attributes. For event handling methods please refer to Chapter 12.
The specific to the Edit widget properties are
setAlphaNumeric, setNumeric, setLabelLength, setPassword,
setSelect. Validation of the user input occurs at the Edit widget level, which implies that the user won't be able to type
non-digit value if setNumeric property, for example, is set'true'.
Method signature
setAlphaNumeric = "[bool]"
[bool] Valid values are true|false. The default is 'false'.
setAlphaNumeric is placed in the Edit element. Set the edit widget to only accept alphanumeric values. If set to true then
the edit widget will only accept A-Z a-z 0-9 to be typed into the widget.
Examples
If no restrictions on the characters for Edit widget are set, you may type any character in the Edit by default.
In this example setAlphaNumeric is set 'true'.
- <Widget setSize="200,100">
- <Edit setAlphaNumeric="true"/>
- </Widget>
Method signature
setNumeric = "[bool]"
[bool] Valid values are true|false. The default is 'false'.
setNumeric is placed in the Edit element. Set the edit widget to only accept numeric values. if set to true then only allow the
digits 0-9 to be typed into the widget.
Examples
- <Widget setSize="200,100">
- <Edit setNumeric="true"/>
- </Widget>
Method signature
setLabelLength = "[int]"
[int] Valid values are integers.
setLabelLength is placed in the Edit element. Set the max label length of this widget. Prevents users from typing in excessively
long labels if lets say the database values are of a fixed length.
Examples
- <Widget setSize="200,100">
- <Edit setLabelLength="3"/>
- </Widget>
Method signature
setPassword = "[bool]"
[bool] Valid values are true|false. The default is 'false'.
setPassword is placed in the Edit element. Set the edit control to be a password field. if true then hides cursor and
display only stars
Examples
- <Widget setSize="200,100">
- <Edit setPassword="true"/>
- </Widget>
Back
Next