Constructor
new TextArea()
Creates an instance of TextArea object.
Classes
Members
(readonly) WrapStyle :number
Enum for word wrapping styles. Used with lineWrap() to control how text is wrapped.
- number
| Name | Type | Description |
|---|---|---|
None | number | Disable line wrapping. |
Word | number | Wrap when a full word doesn't fit. |
Character | number | Wrap when a character doesn't fit. |
TextArea.WrapStyle.WordMethods
lineWrap(valueopt) → {TextArea.WrapStyle|TextArea}
Sets or gets line wrapping mode. Line wrapping helps to display long lines without having to scroll horizontally.
| Name | Type | Attributes | Description |
|---|---|---|---|
value | TextArea. | <optional> | One of: TextArea.WrapStyle.Word, TextArea.WrapStyle.Character, TextArea.WrapStyle.None (default). |
When setting a value, this TextArea component is returned; otherwise a current wrapping mode is returned.
- Type:
- TextArea.
WrapStyle |TextArea
text(textopt, actionopt, insert_positionopt) → {string|TextArea}
Sets or Gets the text value of the text area.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
text | string | <optional> | Text value to replace existing text. | |
action | TextAction | <optional> | TextAction.Set | Specific action to perform with text. One of: TextAction.Set, TextAction.Prepend, TextAction.Append, TextAction.Insert, TextAction.ReplaceSelection. |
insert_position | number | <optional> | undefined) | Position where to insert text. Applies only if |
When setting text, this TextArea component is returned; otherwise current text is returned.
- Type:
- string |
TextArea
const txt = textarea.text(); // gets text value
textarea.text("New Text"); // sets new text value
textarea.text("Appended Text", TextAction.Append); // Appends new text to the end of current text
textarea.text("Inserted Text", TextAction.Insert); // Inserts at current caret position
textarea.text("Inserted Text", TextAction.Insert, textarea.caretPosition() - 50); // Inserts at specified position
textarea.text("New Text", TextAction.ReplaceSelection); // Replaces selected text or inserts at current cursor position if no text is selected