class TextField(Control)

A TextField is a simple single or multi-line text entry area. All text in the field is displayed with the same attributes such as font, color and justification.

Properties

text
Contents of the text field.
selection
A pair (start, end) indicating the starting and ending character positions of the selection. Character positions occur between characters and are numbered from 0.

Note: This property is only valid when the text field is the current target. Setting this property causes the text field to become the target, and the result of reading it when the text field is not the target is undefined.
multiline
Initialize only. A boolean indicating whether multiple lines can be entered.

password
Initialize only. A boolean indicating that the text is to be displayed in an obfuscated manner, as for entering a password.

Note: On some platforms, it may not be possible to combine this with the multiline option.

editable
A boolean indicating whether the user can edit the text. Default is true.

Action Properties

enter_action
Performed when the Return or Enter key is pressed. (Multiline text fields only perform this action when the Enter key on the numeric keypad is used.) The default is to pass the key event to the next handler.

escape_action
Performed when the Escape key is pressed. The default is to pass the key event to the next handler.

tab_action
Performed when the Tab key is pressed. The default is to move the keyboard focus to the next field in the window.

text_changed_action
Performed when the text is changed by the user.

Methods

select_all()
Selects all of the text and makes the text field the current target.
cut_cmd()
copy_cmd()
paste_cmd()
clear_cmd()
These implement the standard editing menu commands. The corresponding menu items are enabled automatically whenever the text field has the keyboard focus.

---