NumberInput view
A number field with a step grid and, optionally, a range.
A view survives a frame. Hold it in an Entity with cx.new(..) and reach it with .update(..).
use gpui_kit::controls::NumberInput;
Construct
new(ident: impl Into<Ident>, window: &mut Window, cx: &mut Context<Self>) -> SelfOptions
Chain onto the value.
value(value: f64) -> Self
range(min: f64, max: f64) -> Self
min(min: f64) -> Self
max(max: f64) -> Self
name(name: impl Into<SharedString>) -> Self
step(step: f64) -> Self
page_step(page_step: f64) -> Self
precision(precision: usize) -> Self
unit(unit: impl Into<SharedString>) -> Self
required(required: bool) -> SelfCommands
Need a Context, so they need a view.
set_value(value: f64, cx: &mut Context<Self>)
set_disabled(disabled: bool, cx: &mut Context<Self>)Queries
Only answer; they change nothing.
current() -> Option<f64>
field() -> &Entity<TextInput>
shown(cx: &App) -> Option<f64>
is_invalid(cx: &App) -> bool
invalid_reason(cx: &App) -> Option<SharedString>
can_step(delta: f64, cx: &App) -> boolReports
The variants of the event it emits. It never applies the change itself.
- Changed
- Unparsable
- Submit
Rendered by
Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.