Introduction
Containers
Layouts
Widgets
Miscellaneous
|
Widgets -> textfield
A textfield is also an editbox (in other terms). You should use textfields
for single-line entries only. If you want multiple lines, use textarea.
To create a textfield, use the following syntax:
$tf = textfield("Initial text" [, properties]);
"Initial text" will be the default text in that textfield.
Properties
| Name | Arguments | Desc | Example |
| cols |
Any integer |
This specifies the number of columns, or the width of the textfield. |
$t = textfield("", 'cols=45'); |
| align |
LEFT, CENTER, or RIGHT |
Specifies the horizontal alignment of text. |
- |
| state |
1 or 0 |
Specifies the initial state of the textfield. 1 is enabled (also the default), and 0 is disabled. |
$t = textfield('Text', 'state=0'); |
| font |
fontsize fontname |
This specifies the font of the checkbox label. A font size MUST be specified along with the font name. |
$t = textfield('Text', 'font=14 Times New Roman');
|
| fontstyle |
BOLD, ITALIC or NORMAL |
This specifies the font style of the checkbox label. This MUST be used with the font property above. |
$t = textfield('Text', 'font=14 Times New Roman', 'fontstyle=BOLD');
|
| command |
name of subroutine |
This specifies the subroutine to be performed if the user hits the RETURN or ENTER key after typing in the textfield |
$tf = textfield("Hit enter", 'command=&showTypedValue'); |
| editable |
1 or 0 |
Specifies whether the textfield is read-only or not. Default is 1. |
$tf = textfield("", 'editable=0'); |
| bounds |
x y w h |
See Absolute Positioning for more info. |
- |
These properties are optional and can be in any order.
Related commands and functions
| enable($textfield) | Self-explanatory. |
| disable($textfield) | Self-explanatory. |
| setText($textfield, string) | Sets the text of the textfield to string. |
| getText($textfield) | Returns the text of the textfield. |
|