Skip to main content

TextEdit

Detailed Description

The TextEdit is a multi-line text editor and often used in log record. The text can be added with append(), all texts can be removed with clear().

Event

Same as Edit, the text edit also has text change and text finish events.
A text change event is emitted whenever there is a change in the text.
A text finish event is emitted when the Enter key is pressed, or if the text edit loses focus and its content has changed since the last time this event was emitted.

// Listen for the text change event
textEdit.bind('textChanged', (event: TextChangeEvent): void => {
event.text; // The current text of the text edit.
});
// Listen for the text finish event
textEdit.bind('textFinished', (event: TextFinishEvent): void => {
event.text; // The current text of the text edit.
});

Example code

In the code below, you will create a text edit:

const desktop = Desktop.instance();
const textEdit = new TextEdit(desktop);
textEdit.text = 'abcdefghijklmnopqrstuvwxyz';