Replies: 1 comment
-
|
ok so here is what i found so far: using self in closure.this is not save as the closure may be executed any time and holding a mut& to self for as long as the element exists seems indeed to not be a good idea. I can circumvent his by making the checkbox callbackit seems that cushys checkbox is only intended to be used for handling other cushy boolean flags. I got a version of the render function working: pub fn render(this: Arc<Mutex<Self>>) -> impl MakeWidget {
let click_state = Dynamic::new(true);
let label = click_state.map_each_cloned( move |is_enabled| {
this.lock().unwrap().set_enabled(is_enabled);
println!("{:#?}",is_enabled);
"Enabled"
});
click_state.clone().to_checkbox(label)
}indeed if I don't use the It is also not possible to return the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
i am struggling to understand how to implement a callback on checkbox click.
my problems are:
selfinside the map_eachself.set_enabled(is_enabled);my closure is never called when clicking the checkbox.Beta Was this translation helpful? Give feedback.
All reactions