mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-12 20:23:35 +00:00
Edit refcell_view example to use find_id
This commit is contained in:
parent
23b0f9c168
commit
30f13fc260
@ -28,12 +28,12 @@ fn on_edit(siv: &mut Cursive, _content: &str, _cursor: usize) {
|
||||
// Get handles for each view.
|
||||
let edit_1 = siv.find_id_mut::<EditView>("1").unwrap();
|
||||
let edit_2 = siv.find_id_mut::<EditView>("2").unwrap();
|
||||
let mut text = siv.find_id_mut::<TextView>("match").unwrap();
|
||||
|
||||
// Directly compare references to edit_1 and edit_2.
|
||||
text.set_content(if edit_1.get_content() == edit_2.get_content() {
|
||||
let matches = edit_1.get_content() == edit_2.get_content();
|
||||
siv.find_id("match", |v: &mut TextView| v.set_content(if matches {
|
||||
"match"
|
||||
} else {
|
||||
"no match"
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user