Merge pull request #598 from oknozor/input-text-focus

Add textinput focus method
This commit is contained in:
Héctor Ramón 2020-11-09 20:49:42 +01:00 committed by GitHub
commit d0402d072d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -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