SpinBox
Numeric field with expressions and increment buttons.
SpinBox combines Range, an internal LineEdit and increment buttons. Defaults are Step = 1, Editable = true and UpdateOnTextChanged = false; additional format and arrow-step settings are off. Set an appropriate Step for fractional values.
GetLineEdit returns a SpinBox-owned internal Control: configure it without freeing or reparenting it. Assigning LineEdit.Text in code neither assigns Value nor emits TextChanged. Call Apply to commit that text. For example, 2 + 3 * 4 produces Value = 14; Range then snaps and bounds the result. Empty or syntactically invalid input does not replace the previous number.
UpdateOnTextChanged connects deferred processing of the internal field’s signal. It does not turn the Text setter into automatic numeric input. Intermediate expressions can update Value before editing finishes; avoid attaching expensive work to every entered digit unnecessarily.
Format controls display outside active editing. Use a template with one value: %s kg uses standard Step-aware text; %.2f kg displays two decimal places without changing Value precision. This is the engine’s sprintf format rather than C# string.Format. Invalid templates can display <Invalid>. Deprecated Prefix/Suffix only apply when Format is empty.
FormatAutoTranslateMode defaults to Disabled. For translated units, set Format, optionally PluralFormat and enable an appropriate translation mode; PluralFormat alone does not create localization.
CustomArrowStep = 0 uses Step; a nonzero value changes button increments rather than Range snapping. CustomArrowRound aligns transitions to the arrow-step grid; choose a multiple of Step or an increment may fail to change the number. Editable = false blocks user editing rather than programmatic Value writes or Apply.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
SpinBoxConstructor
public SpinBox();Creates a numeric field with an internal LineEdit and button timer. Step = 1, Editable = true, UpdateOnTextChanged = false; Format is empty.
Properties11
AlignmentProperty
public HorizontalAlignment Alignment { get; set; }Horizontal text alignment of the internal LineEdit, default Left. Does not move SpinBox within its parent layout.
CustomArrowRoundProperty
public bool CustomArrowRound { get; set; }Aligns button transitions to the CustomArrowStep grid rather than simply adding/subtracting, default false. Arrow increment must be compatible with Step or a transition can leave Value unchanged.
CustomArrowStepProperty
public double CustomArrowStep { get; set; }Button increment: 0 uses Step; nonzero uses a custom increment. Does not replace Range snapping, so choose a compatible increment. Does not recalculate current Value.
EditableProperty
public bool Editable { get; set; }Allows user editing through the internal LineEdit and buttons, default true. Does not block programmatic Value or Apply.
FormatProperty
public string Format { get; set; }Single-value sprintf template for display outside editing. %s uses standard Step-aware text; %.2f displays two decimal places. Does not change Value; takes precedence over Prefix/Suffix. Invalid templates can display <Invalid>.
FormatAutoTranslateModeProperty
public Entity.AutoTranslateModeEnum FormatAutoTranslateMode { get; set; }Automatic Format/PluralFormat translation: default Disabled, Always forces translation, Inherit respects entity translation. Does not itself add catalog translations.
PluralFormatProperty
public string PluralFormat { get; set; }Plural-form template for Format translation. Requires nonempty Format and translation enabled through FormatAutoTranslateMode; selection uses Value and the translation catalog.
PrefixProperty · Deprecated
public string Prefix { get; set; }Deprecated display prefix separated from the number by a space. Applies only with empty Format outside editing. Use Format for new code.
SelectAllOnFocusProperty
public bool SelectAllOnFocus { get; set; }Select all text on focus, default false. Delegated to the internal LineEdit; toggling the setting does not request focus.
SuffixProperty · Deprecated
public string Suffix { get; set; }Deprecated display suffix separated from the number by a space. Applies only with empty Format outside editing. Not part of numeric Value.
UpdateOnTextChangedProperty
public bool UpdateOnTextChanged { get; set; }Apply expressions through a deferred connection to the internal field’s TextChanged, default false. Programmatic LineEdit.Text writes do not emit that signal; use Apply.
Methods24
Applyvoid
public void Apply();Parses current internal LineEdit text as a numeric expression and assigns the result to Value. Empty or syntactically invalid text preserves the previous number. Call after programmatic Text assignment; there is no Error/bool result.
GetCustomArrowStepdouble
public double GetCustomArrowStep();Button increment: 0 uses Step; nonzero uses a custom increment. Does not replace Range snapping, so choose a compatible increment. Does not recalculate current Value.
doubleCurrent setting rather than confirmation of input or visual validation.
GetFormatstring
public string GetFormat();Single-value sprintf template for display outside editing. %s uses standard Step-aware text; %.2f displays two decimal places. Does not change Value; takes precedence over Prefix/Suffix. Invalid templates can display <Invalid>.
stringCurrent setting rather than confirmation of input or visual validation.
GetFormatAutoTranslateModeEntity.AutoTranslateModeEnum
public Entity.AutoTranslateModeEnum GetFormatAutoTranslateMode();Automatic Format/PluralFormat translation: default Disabled, Always forces translation, Inherit respects entity translation. Does not itself add catalog translations.
Entity.AutoTranslateModeEnumCurrent setting rather than confirmation of input or visual validation.
GetHorizontalAlignmentHorizontalAlignment
public HorizontalAlignment GetHorizontalAlignment();Horizontal text alignment of the internal LineEdit, default Left. Does not move SpinBox within its parent layout.
HorizontalAlignmentCurrent setting rather than confirmation of input or visual validation.
GetLineEditLineEdit
public LineEdit GetLineEdit();Returns the shared internal LineEdit owned by SpinBox. Do not free or reparent it. Text is editing text rather than guaranteed Value; use Apply for programmatic commitment.
LineEditShared LineEdit owned by SpinBox; do not free separately.
GetPluralFormatstring
public string GetPluralFormat();Plural-form template for Format translation. Requires nonempty Format and translation enabled through FormatAutoTranslateMode; selection uses Value and the translation catalog.
stringCurrent setting rather than confirmation of input or visual validation.
GetPrefixstring
public string GetPrefix();Deprecated display prefix separated from the number by a space. Applies only with empty Format outside editing. Use Format for new code.
stringCurrent setting rather than confirmation of input or visual validation.
GetSuffixstring
public string GetSuffix();Deprecated display suffix separated from the number by a space. Applies only with empty Format outside editing. Not part of numeric Value.
stringCurrent setting rather than confirmation of input or visual validation.
GetUpdateOnTextChangedbool
public bool GetUpdateOnTextChanged();Apply expressions through a deferred connection to the internal field’s TextChanged, default false. Programmatic LineEdit.Text writes do not emit that signal; use Apply.
boolCurrent setting rather than confirmation of input or visual validation.
IsCustomArrowRoundingbool
public bool IsCustomArrowRounding();Aligns button transitions to the CustomArrowStep grid rather than simply adding/subtracting, default false. Arrow increment must be compatible with Step or a transition can leave Value unchanged.
boolCurrent setting rather than confirmation of input or visual validation.
IsEditablebool
public bool IsEditable();Allows user editing through the internal LineEdit and buttons, default true. Does not block programmatic Value or Apply.
boolCurrent setting rather than confirmation of input or visual validation.
IsSelectAllOnFocusbool
public bool IsSelectAllOnFocus();Select all text on focus, default false. Delegated to the internal LineEdit; toggling the setting does not request focus.
boolCurrent setting rather than confirmation of input or visual validation.
SetCustomArrowRoundvoid
public void SetCustomArrowRound(bool round);Aligns button transitions to the CustomArrowStep grid rather than simply adding/subtracting, default false. Arrow increment must be compatible with Step or a transition can leave Value unchanged.
| Name | Type | Default |
|---|---|---|
round | bool | — |
roundAligns button transitions to the CustomArrowStep grid rather than simply adding/subtracting, default false. Arrow increment must be compatible with Step or a transition can leave Value unchanged.
SetCustomArrowStepvoid
public void SetCustomArrowStep(double arrowStep);Button increment: 0 uses Step; nonzero uses a custom increment. Does not replace Range snapping, so choose a compatible increment. Does not recalculate current Value.
| Name | Type | Default |
|---|---|---|
arrowStep | double | — |
arrowStepButton increment: 0 uses Step; nonzero uses a custom increment. Does not replace Range snapping, so choose a compatible increment. Does not recalculate current Value.
SetEditablevoid
public void SetEditable(bool enabled);Allows user editing through the internal LineEdit and buttons, default true. Does not block programmatic Value or Apply.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledAllows user editing through the internal LineEdit and buttons, default true. Does not block programmatic Value or Apply.
SetFormatvoid
public void SetFormat(string format);Single-value sprintf template for display outside editing. %s uses standard Step-aware text; %.2f displays two decimal places. Does not change Value; takes precedence over Prefix/Suffix. Invalid templates can display <Invalid>.
| Name | Type | Default |
|---|---|---|
format | string | — |
formatSingle-value sprintf template for display outside editing. %s uses standard Step-aware text; %.2f displays two decimal places. Does not change Value; takes precedence over Prefix/Suffix. Invalid templates can display <Invalid>.
SetFormatAutoTranslateModevoid
public void SetFormatAutoTranslateMode(Entity.AutoTranslateModeEnum mode);Automatic Format/PluralFormat translation: default Disabled, Always forces translation, Inherit respects entity translation. Does not itself add catalog translations.
| Name | Type | Default |
|---|---|---|
mode | Entity.AutoTranslateModeEnum | — |
modeAutomatic Format/PluralFormat translation: default Disabled, Always forces translation, Inherit respects entity translation. Does not itself add catalog translations.
SetHorizontalAlignmentvoid
public void SetHorizontalAlignment(HorizontalAlignment alignment);Horizontal text alignment of the internal LineEdit, default Left. Does not move SpinBox within its parent layout.
| Name | Type | Default |
|---|---|---|
alignment | HorizontalAlignment | — |
alignmentHorizontal text alignment of the internal LineEdit, default Left. Does not move SpinBox within its parent layout.
SetPluralFormatvoid
public void SetPluralFormat(string format);Plural-form template for Format translation. Requires nonempty Format and translation enabled through FormatAutoTranslateMode; selection uses Value and the translation catalog.
| Name | Type | Default |
|---|---|---|
format | string | — |
formatPlural-form template for Format translation. Requires nonempty Format and translation enabled through FormatAutoTranslateMode; selection uses Value and the translation catalog.
SetPrefixvoid
public void SetPrefix(string prefix);Deprecated display prefix separated from the number by a space. Applies only with empty Format outside editing. Use Format for new code.
| Name | Type | Default |
|---|---|---|
prefix | string | — |
prefixDeprecated display prefix separated from the number by a space. Applies only with empty Format outside editing. Use Format for new code.
SetSelectAllOnFocusvoid
public void SetSelectAllOnFocus(bool enabled);Select all text on focus, default false. Delegated to the internal LineEdit; toggling the setting does not request focus.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledSelect all text on focus, default false. Delegated to the internal LineEdit; toggling the setting does not request focus.
SetSuffixvoid
public void SetSuffix(string suffix);Deprecated display suffix separated from the number by a space. Applies only with empty Format outside editing. Not part of numeric Value.
| Name | Type | Default |
|---|---|---|
suffix | string | — |
suffixDeprecated display suffix separated from the number by a space. Applies only with empty Format outside editing. Not part of numeric Value.
SetUpdateOnTextChangedvoid
public void SetUpdateOnTextChanged(bool enabled);Apply expressions through a deferred connection to the internal field’s TextChanged, default false. Programmatic LineEdit.Text writes do not emit that signal; use Apply.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledApply expressions through a deferred connection to the internal field’s TextChanged, default false. Programmatic LineEdit.Text writes do not emit that signal; use Apply.
Theme properties
These are Theme resource keys, not C# properties. Use the matching Control GetTheme…() and AddTheme…Override() methods for each value type.
| Key and type | Description |
|---|---|
down_disabled_icon_modulateColor | Down button icon modulation color, when the button is disabled. Default:Color(0.875, 0.875, 0.875, 0.5) |
down_hover_icon_modulateColor | Down button icon modulation color, when the button is hovered. Default:Color(0.95, 0.95, 0.95, 1) |
down_icon_modulateColor | Down button icon modulation color. Default:Color(0.875, 0.875, 0.875, 1) |
down_pressed_icon_modulateColor | Down button icon modulation color, when the button is being pressed. Default:Color(0.95, 0.95, 0.95, 1) |
up_disabled_icon_modulateColor | Up button icon modulation color, when the button is disabled. Default:Color(0.875, 0.875, 0.875, 0.5) |
up_hover_icon_modulateColor | Up button icon modulation color, when the button is hovered. Default:Color(0.95, 0.95, 0.95, 1) |
up_icon_modulateColor | Up button icon modulation color. Default:Color(0.875, 0.875, 0.875, 1) |
up_pressed_icon_modulateColor | Up button icon modulation color, when the button is being pressed. Default:Color(0.95, 0.95, 0.95, 1) |
buttons_vertical_separationint | Vertical separation between the up and down buttons. Default:0 |
buttons_widthint | Width of the up and down buttons. If smaller than any icon set on the buttons, the respective icon may overlap neighboring elements. If smaller than 16 |
field_and_buttons_separationint | Width of the horizontal separation between the text input field ( 2 |
icon_max_widthint | The maximum allowed width of the 0 |
set_min_buttons_width_from_iconsint | If not 1 |
downTexture2D | Down button icon, displayed in the middle of the down (value-decreasing) button. |
down_disabledTexture2D | Down button icon when the button is disabled. |
down_hoverTexture2D | Down button icon when the button is hovered. |
down_pressedTexture2D | Down button icon when the button is being pressed. |
upTexture2D | Up button icon, displayed in the middle of the up (value-increasing) button. |
up_disabledTexture2D | Up button icon when the button is disabled. |
up_hoverTexture2D | Up button icon when the button is hovered. |
up_pressedTexture2D | Up button icon when the button is being pressed. |
updownTexture2D | Single texture representing both the up and down buttons icons. It is displayed in the middle of the buttons and does not change upon interaction. If a valid icon is assigned, it will replace |
focus_soundAudioStream | Played when this |
pressed_disabled_soundAudioStream | Played when the up or down button is pressed while the |
pressed_soundAudioStream | Played when the up or down button is pressed. |
down_backgroundStyleBox | Background style of the down button. |
down_background_disabledStyleBox | Background style of the down button when disabled. |
down_background_hoveredStyleBox | Background style of the down button when hovered. |
down_background_pressedStyleBox | Background style of the down button when being pressed. |
field_and_buttons_separatorStyleBox |
|
up_backgroundStyleBox | Background style of the up button. |
up_background_disabledStyleBox | Background style of the up button when disabled. |
up_background_hoveredStyleBox | Background style of the up button when hovered. |
up_background_pressedStyleBox | Background style of the up button when being pressed. |
up_down_buttons_separatorStyleBox |
|