TextEdit
Similar to LineEdit
`, but can be used to enter several lines of text.
Properties
font_size
(in length): the size of the font of the input texttext
(in_out string): The text being editedhas_focus
: (in_out bool): Set to true when the widget currently has the focusenabled
: (in bool): Defaults to true. When false, nothing can be enteredread_only
(in bool): When set to true, text editing via keyboard and mouse is disabled but selecting text is still enabled as well as editing text programmatically (default value:false
)wrap
(in enumTextWrap
): The way the text wraps (default: word_wrap).horizontal_alignment
(in enumTextHorizontalAlignment
): The horizontal alignment of the text.
Functions
focus()
Call this function to focus the TextEdit and make it receive future keyboard events.select_all()
Selects all text.clear_selection()
Clears the selection.copy()
Copies the selected text to the clipboard.cut()
Copies the selected text to the clipboard and removes it from the editable area.paste()
Pastes the text content of the clipboard at the cursor position.
Callbacks
edited(string)
: Emitted when the text has changed because the user modified it
Example
import { TextEdit } from "@coop/lib.slint";
export component Example inherits Window {
width: 200px;
height: 200px;
TextEdit {
font_size: 14px;
width: parent.width;
height: parent.height;
text: "Lorem ipsum dolor sit amet,\n consectetur adipisici elit";
}
}