Skip to main content

Module number

Module number 

Source
Expand description

A number input (a spin box): the value typed in a field, its unit beside it, and small up and down arrows. For a value whose range is too wide for a slider (a count up to millions, days up to years).

Experimental: may change in any release (docs/stability.md).
  • Typing commits on Enter or when the field loses focus; Escape drops the typed text.
  • A typed value outside the range, a fraction where a whole number is expected, or a text that is not a number is refused: the value stays and the reason shows beside the field.
  • The arrows, the Up and Down keys and the mouse wheel (over the focused field) step the value, clamped to the range; with Shift, ten steps at once.
  • The value is shown in the interface’s number format (large counts grouped: 1 000 000).
use egui_pop_core::number::NumberInput;

fn kept(ui: &mut egui::Ui, files: &mut f64) {
    NumberInput::new(files, "Files kept", 1000.0..=100_000_000.0)
        .integer()
        .unit("files")
        .show(ui);
}

Structs§

NumberInput
A number input; see the module.

Enums§

Refusal
Why a typed value was refused.

Constants§

SLIDER_SPAN
The widest range, max - min, still drawn as a slider by crate::param; past it, a value is a NumberInput. An image parameter (a radius up to 500, a black point up to 255, a hue in degrees) still slides; a count up to millions or days up to years is typed. A descriptor’s soft range, when it has one, is the range measured: its author asked for a slider over it.

Functions§

is_wide
Whether a number descriptor is better typed than slid: its range is wider than SLIDER_SPAN.