pub trait SliderModifiers: Sized {
// Required methods
fn on_change<F>(self, callback: F) -> Self
where F: 'static + Fn(&mut EventContext<'_>, f32);
fn range<U>(self, range: impl Res<U> + 'static) -> Self
where U: Into<Range<f32>> + Clone + 'static;
fn vertical<U>(self, vertical: impl Res<U> + 'static) -> Self
where U: Into<bool> + Clone + 'static;
fn step<U>(self, step: impl Res<U> + 'static) -> Self
where U: Into<f32> + Clone + 'static;
fn default_value<U>(self, default_value: impl Res<U> + 'static) -> Self
where U: Into<f32> + Clone + 'static;
}Required Methods§
Sourcefn on_change<F>(self, callback: F) -> Self
fn on_change<F>(self, callback: F) -> Self
Sets the callback triggered when the slider value is changed.
Takes a closure which triggers when the slider value is changed, either by pressing the track or dragging the thumb along the track.
Slider::new(cx, value)
.on_change(|cx, value| {
let _ = (cx, value);
});Sourcefn range<U>(self, range: impl Res<U> + 'static) -> Self
fn range<U>(self, range: impl Res<U> + 'static) -> Self
Sets the range of the slider.
If the source value is outside of the range then the slider will clip to min/max of the range.
Slider::new(cx, value)
.range(-20.0..50.0)
.on_change(|cx, value| {
let _ = (cx, value);
});Sourcefn vertical<U>(self, vertical: impl Res<U> + 'static) -> Self
fn vertical<U>(self, vertical: impl Res<U> + 'static) -> Self
Sets the orientation of the slider to vertical.
Slider::new(cx, value)
.vertical(true)
.on_change(|cx, value| {
let _ = (cx, value);
});Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.