diff --git a/src/views/radio.rs b/src/views/radio.rs index 4c48e3c..03d3421 100644 --- a/src/views/radio.rs +++ b/src/views/radio.rs @@ -81,6 +81,15 @@ impl RadioGroup { ) { self.state.borrow_mut().on_change = Some(Rc::new(on_change)); } + + /// Sets a callback to be used when the selection changes. + /// + /// Chainable variant. + pub fn on_change( + self, on_change: F, + ) -> Self { + self.with(|s| s.set_on_change(on_change)) + } } impl RadioGroup { @@ -148,6 +157,7 @@ impl RadioButton { /// Chainable variant. pub fn selected(self) -> Self { self.with(|s| { + // Ignore the potential callback here s.select(); }) }