summaryrefslogtreecommitdiffstats
path: root/native/src/widget
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/widget')
-rw-r--r--native/src/widget/text_input.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index 64182f2d..470e92ed 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -693,6 +693,20 @@ impl State {
self.cursor
}
+ /// Focuses the [`TextInput`].
+ ///
+ /// [`TextInput`]: struct.TextInput.html
+ pub fn focus(&mut self) {
+ self.is_focused = true;
+ }
+
+ /// Unfocuses the [`TextInput`].
+ ///
+ /// [`TextInput`]: struct.TextInput.html
+ pub fn unfocus(&mut self) {
+ self.is_focused = false;
+ }
+
/// Moves the [`Cursor`] of the [`TextInput`] to the front of the input text.
///
/// [`Cursor`]: struct.Cursor.html