Skip to content

Commit

Permalink
Add textinput focus method
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Nov 6, 2020
1 parent e613178 commit 2af31e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pkg/
**/*.rs.bk
Cargo.lock
.cargo/
.idea
2 changes: 1 addition & 1 deletion glow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ image = []
svg = []

[dependencies]
glow = "0.5"
glow = "0.6.1"
glow_glyph = "0.3"
glyph_brush = "0.7"
euclid = "0.20"
Expand Down
6 changes: 6 additions & 0 deletions native/src/widget/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2af31e3

Please sign in to comment.