pub struct NumericField { /* private fields */ }Expand description
A single numeric field supporting browse mode (arrow incr/decr) and edit mode (direct digit entry).
Implementations§
Source§impl NumericField
impl NumericField
pub fn new(label: impl Into<String>) -> Self
Sourcepub fn float(self, decimals: u8) -> Self
pub fn float(self, decimals: u8) -> Self
Set the field to float mode with the given number of decimal places.
Sourcepub fn none_label(self, label: &'static str) -> Self
pub fn none_label(self, label: &'static str) -> Self
Set the label shown when value is None.
Sourcepub fn is_editing(&self) -> bool
pub fn is_editing(&self) -> bool
Whether the field is in edit (text entry) mode.
Sourcepub fn display_value(&self) -> String
pub fn display_value(&self) -> String
Format the current value for display.
Sourcepub fn handle_key(&mut self, key: &KeyPress) -> WidgetResult<Option<f64>>
pub fn handle_key(&mut self, key: &KeyPress) -> WidgetResult<Option<f64>>
Handle a key press. Returns Confirmed when Enter is pressed in browse mode,
Cancelled when Escape is pressed in browse mode.
Auto Trait Implementations§
impl Freeze for NumericField
impl RefUnwindSafe for NumericField
impl Send for NumericField
impl Sync for NumericField
impl Unpin for NumericField
impl UnsafeUnpin for NumericField
impl UnwindSafe for NumericField
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more