DVUI

NumberFieldOptions

Controls how numeric fields are displayed. Note that min and max are stored as f64, which can represent all integer values up to an i53/u53.

Fields

#
display:FieldOptions.DisplayMode
FieldOptions.DisplayMode
label:?[]const u8
?[]const u8
customDisplayFn:?*const fn ([]const u8, *anyopaque, bool, *dvui.Alignment) void
?*const fn ([]const u8, *anyopaque, bool, *dvui.Alignment) void
default_expanded:?bool
?bool
widget_type:enum { number_entry, slider, slider_entry, // Apply a number only when the user presses enter. // Display the value as a placeholder if no value is being entered. entry_on_enter, }

For .read_write, display as either a text entry box or as a slider.

min:?f64

Minimum value - required if widget_type is slider.

max:?f64

Maximum value - required if widget_type is slider.

Functions

#
initAsSlider

Display as a slider.

minValue

Return a typed copy of the min value

maxValue

Return a typed copy of the max value

cast

Cast between different numeric types.

normalizedPercentToNum

For slider, convert slider percentage into a number between min and max.

toNormalizedPercent

For slider, convert number to a slider percentage