From f7d67598cb2ce4102211f54eca45dc49eabec7cc Mon Sep 17 00:00:00 2001 From: Paul Delafosse Date: Fri, 6 Nov 2020 08:20:03 +0100 Subject: Add textinput focus method --- native/src/widget/text_input.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'native/src') diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 64182f2d..7af59ba1 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -716,6 +716,12 @@ impl State { pub fn move_cursor_to(&mut self, position: usize) { self.cursor.move_to(position); } + + /// Change the focus of the [`TextInput`] state. + /// [`TextInput`]: struct.TextInput.html + pub fn focus(&mut self, state: bool) { + self.is_focused = state + } } // TODO: Reduce allocations -- cgit