Add focus switch to list_view example

This commit is contained in:
Alexandre Bury 2017-03-28 19:00:46 -07:00
parent d3669814b5
commit 5ac68b1ebf

View File

@ -13,6 +13,17 @@ fn main() {
.button("Ok", |s| s.quit())
.content(ListView::new()
.child("Name", EditView::new().fixed_width(10))
.child("Receive spam?",
Checkbox::new()
.on_change(|s, checked| for name in &["email1",
"email2"] {
s.call_on_id(name, |view: &mut EditView| {
view.set_enabled(checked)
});
if checked {
s.focus_id("email1").unwrap();
}
}))
.child("Email",
LinearLayout::horizontal()
.child(EditView::new()
@ -24,14 +35,6 @@ fn main() {
.disabled()
.with_id("email2")
.fixed_width(10)))
.child("Receive spam?",
Checkbox::new()
.on_change(|s, checked| for name in &["email1",
"email2"] {
s.call_on_id(name, |view: &mut EditView| {
view.set_enabled(checked)
});
}))
.delimiter()
.child("Age",
SelectView::new()