This control is used to display and edit a single line of text. If you need to edit multiple lines of text, use dEditBox. If you simply want to display some text, you might want to use dLabel instead.
Some of the more useful properties:
- Alignment (str): Can be one of
Center. Determines the position of the text within the control area.
- SelectedText (str): Returns just the text selected by the user, or an empty string.
- SelectionStart, SelectionEnd, SelectionLength, InsertionPosition (int): Determines various aspects of the selected text in the control. Note that these properties are inter-dependent, so changing one can change one or more of the others.
- ReadOnly (bool): allows the user to select and copy the text, but they cannot change it. This is different than
Enabled=False, where they cannot interact with the control at all.
- SelectOnEntry (bool): When
True, the contents of the control are selected when the control receives focus.
- PasswordEntry (bool): when
True, the entered text is hidden, and bullets are shown instead. This must be set when the control is created.
Some of the more common events:
- KeyChar: raised when a key is pressed. You can access information about that key and any modifiers with the following:
- evt.keyChar: contains the character that was typed.
- evt.keyCode: contains the internal number that represents the typed character. Will usually be the same as the ASCII value of that character.
- evt.altDown, evt.commandDown, evt.controlDown, evt.metaDown, evt.shiftDown: these will be
Trueif the corresponding modifier key was pressed when the key event occurred.
- GotFocus: raised when the control receives focus.
- LostFocus: raised when the control loses focus.
See the Dabo Class Documentation for an exhaustive documentation of this control's Properties, Events and Methods. (Note that this documentation is no longer live, but it's still available via the Internet Archive).