pub struct NumberInput<'a, T: Numeric> { /* private fields */ }Expand description
Numeric text entry with a draft independent of the confirmed value. Enter commits valid input; Escape restores the focus-session value. Focus loss commits valid input and discards invalid input. Disabled discards drafts. Up/Down adjust the confirmed value; Shift is precise and Ctrl accelerated.
Implementations§
Source§impl<'a, T: Numeric> NumberInput<'a, T>
impl<'a, T: Numeric> NumberInput<'a, T>
pub fn new(value: &'a mut T) -> Self
pub fn id_source(self, source: impl Hash) -> Self
Sourcepub fn range(self, range: RangeInclusive<T>) -> Self
pub fn range(self, range: RangeInclusive<T>) -> Self
Commits and gestures clamp to the bounds; idle values are untouched. Descending bounds are swapped and non-finite ones are ignored.
Sourcepub fn step(self, step: T) -> Self
pub fn step(self, step: T) -> Self
Positive step in the value’s own type; integers default to one. Typed commits are not snapped. Anything not positive is ignored.
Sourcepub fn precision(self, precision: usize) -> Self
pub fn precision(self, precision: usize) -> Self
Display precision for floats, without rounding the stored number; at most 16. Integers never show decimals.
Sourcepub fn formatter(self, formatter: impl Fn(T) -> String + 'a) -> Self
pub fn formatter(self, formatter: impl Fn(T) -> String + 'a) -> Self
Display-only formatter. Editing always uses the exact, parseable number.
pub fn prefix(self, text: impl Into<String>) -> Self
pub fn suffix(self, text: impl Into<String>) -> Self
pub fn enabled(self, enabled: bool) -> Self
pub fn disabled(self, disabled: bool) -> Self
use .enabled(!disabled); enabled is the one way to set a control’s availability
Sourcepub fn status(self, status: SemanticStatus) -> Self
pub fn status(self, status: SemanticStatus) -> Self
Validation state: the border and a soft ring take the status color. Fields inherit
the status of an enclosing super::Field unless this is set.
pub fn corner_radius(self, radius: impl Into<CornerRadius>) -> Self
pub fn hover_style(self, style: HoverStyle) -> Self
pub fn width(self, width: f32) -> Self
pub fn style(self, style: NumberStyle) -> Self
Sourcepub fn sensitivity(self, sensitivity: f64) -> Self
pub fn sensitivity(self, sensitivity: f64) -> Self
Steps per logical pixel. The typed step determines the units.
Trait Implementations§
Source§impl<T: Numeric> Widget for NumberInput<'_, T>
impl<T: Numeric> Widget for NumberInput<'_, T>
fn ui(self, ui: &mut Ui<'_>) -> Response
Source§fn tooltip(self, text: impl Into<String>) -> TooltipWidget<Self>where
Self: Sized,
fn tooltip(self, text: impl Into<String>) -> TooltipWidget<Self>where
Self: Sized,
ui.add(Button::new("Save").tooltip("Write the file")).Response::menu_selected on the pass it is picked.Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for NumberInput<'a, T>
impl<'a, T> !Send for NumberInput<'a, T>
impl<'a, T> !Sync for NumberInput<'a, T>
impl<'a, T> !UnwindSafe for NumberInput<'a, T>
impl<'a, T> Freeze for NumberInput<'a, T>
impl<'a, T> Unpin for NumberInput<'a, T>
impl<'a, T> UnsafeUnpin for NumberInput<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.