select first item in listviews initially

This commit is contained in:
Henrik Friedrichsen
2019-03-17 23:03:07 +01:00
parent 9842b89457
commit e0d1d456f4
3 changed files with 17 additions and 38 deletions

View File

@@ -42,7 +42,7 @@ impl SearchView {
results: results,
edit: searchfield,
list: scrollable,
edit_focused: false,
edit_focused: true,
}
}
@@ -67,14 +67,6 @@ impl SearchView {
}
}
pub fn focus_search(&mut self) {
self.edit
.call_on(&Selector::Id("search_edit"), |v: &mut EditView| {
v.set_content("");
});
self.edit_focused = true;
}
fn pass_event_focused(&mut self, event: Event) -> EventResult {
match self.edit_focused {
true => self.edit.on_event(event),