UDreamSpinBox
A spin box whose hierarchy is code, not an asset.
本页由 DreamGUIReferenceDocs commandlet 从反射生成,正文是头文件注释的原文(英文),所以不翻译——这样它永远和代码一致。概念讲解见核心概念。
Inherits from UDreamUIControl.
Declared in Public/Controls/DreamSpinBox.h.
A spin box whose hierarchy is code, not an asset.
USpinBox's pragmatic core: a number, a range, a step -- spelled as a row of three parts, [-] field [+], because that row is buildable from what the library already has. The step faces carry UIButton behaviours, the field carries UUITextInput hosting the value as culture-invariant text, and the CONTROL owns the number: buttons and submitted text are two roads into one clamp-assign-push-broadcast, so the field, the property and the event can never disagree about what the value is.
Every push into the parts is WithoutNotify -- writing authored state is not the user editing -- and OnValueChanged fires exactly when the clamped value actually changes.
DRAG TO SCRUB is the other half of USpinBox, and it needed no capture plumbing of its own in the end: UUITextInput already hands a drag UP when it is not being edited (its OnPointerBeginDrag returns "bubble" unless bInputActive), so a drag that starts on an idle field arrives here as this control's own NativeOnBeginDrag, and a drag inside a field the player is editing stays the text selection's. That is exactly the rule SSpinBox follows -- click to type, drag to scrub -- arrived at by asking who already owns the gesture rather than by inventing a mode.
The scrub sweeps MinSliderValue..MaxSliderValue (which default to the hard range) across the control's own width, bent by SliderExponent so a large range can still be fine near one end. It counts from where the drag was recognised, not from the press: the travel that turned the press into a drag moves nothing, as in SSpinBox, so the value does not leap by the drag threshold the moment a scrub starts.
/Script/DreamGUIControls.DreamSpinBox Count {
Value = 5
MaxValue = 10
OnValueChanged -> HandleCountProperties
| Name | Type | Category | In the details panel | From Blueprint | Description |
|---|---|---|---|---|---|
Style | FDreamSpinBoxStyle | Spin Box | yes | GetStyle / SetStyle | This instance's own look. The project sheet wins while StyleSource says so AND a sheet actually exists; with no sheet in the project this IS the look in effect -- which is why it stays editable instead of being gated on the enum: the old edit condition greyed the exact values that were driving the control. |
Value | float | Spin Box | yes | GetValue / SetValue | Authored value in; the control's own thereafter. A property so .dui and bindings can see it. |
MinValue | float | Spin Box | yes | GetMinValue / SetMinValue | |
MaxValue | float | Spin Box | yes | GetMaxValue / SetMaxValue | |
StepSize | float | Spin Box | yes | GetStepSize / SetStepSize | What one click of a step face adds or removes, before clamping. UMG calls it Delta. |
MinSliderValue | float | Spin Box | yes | GetMinSliderValue / SetMinSliderValue | |
MaxSliderValue | float | Spin Box | yes | GetMaxSliderValue / SetMaxSliderValue | |
SliderExponent | float | Spin Box | yes | GetSliderExponent / SetSliderExponent | How the drag's distance bends into the value -- UMG's SliderExponent. One is linear; larger numbers give the low end of the range more of the travel, which is what a range spanning several orders of magnitude needs to be usable at its bottom. |
bEnableSlider | bool | Spin Box | yes | GetEnableSlider / SetEnableSlider | Whether dragging the field scrubs the value at all -- UMG's EnableSlider. |
bAlwaysUsesDeltaSnap | bool | Spin Box | yes | GetAlwaysUsesDeltaSnap / SetAlwaysUsesDeltaSnap | Every value, however it arrived, snapped to a multiple of StepSize -- UMG's AlwaysUsesDeltaSnap. Off (the default), only the step faces move in whole steps and a drag or a typed value is free. |
MinFractionalDigits | int32 | Spin Box | yes | GetMinFractionalDigits / SetMinFractionalDigits | How the number is SPELLED -- UMG's MinFractionalDigits / MaxFractionalDigits. |
MaxFractionalDigits | int32 | Spin Box | yes | GetMaxFractionalDigits / SetMaxFractionalDigits | |
bClearKeyboardFocusOnCommit | bool | Spin Box | yes | GetClearKeyboardFocusOnCommit / SetClearKeyboardFocusOnCommit | Stop editing the field when the value is committed -- UMG's ClearKeyboardFocusOnCommit. |
bSelectAllTextOnCommit | bool | Spin Box | yes | GetSelectAllTextOnCommit / SetSelectAllTextOnCommit | Select the whole number when the value is committed, ready to be typed over. TRUE here where UMG's is false: a spin box is filled in one entry after another and this is what it has always done. |
Justification | EDreamUITextParagraphHorizontalAlign | Spin Box | yes | GetJustification / SetJustification | How the number sits across the field -- UMG's Justification. Centre by default, which is where the built-in tree has always put it. |
MinDesiredWidth | float | Spin Box | yes | GetMinDesiredWidth / SetMinDesiredWidth | A floor under the width the control asks a content-sized parent for -- UMG's MinDesiredWidth. Zero means no opinion, which is every spin box that exists today. |
KeyboardType | TEnumAsByte<EVirtualKeyboardType::Type> | Spin Box | yes | GetKeyboardType / SetKeyboardType | Which virtual keyboard the typed-entry field summons. Default derives it from the field's type. |
VirtualKeyboardDismissAction | EVirtualKeyboardDismissAction | Spin Box | yes | GetVirtualKeyboardDismissAction / SetVirtualKeyboardDismissAction | What dismissing that keyboard means -- pushed straight to the field's behaviour. |
DecrementNode | TObjectPtr<UDreamWidget> | Spin Box | - | read only | |
DecrementLabelNode | TObjectPtr<UDreamWidget> | Spin Box | - | read only | |
FieldNode | TObjectPtr<UDreamWidget> | Spin Box | - | read only | |
ClipNode | TObjectPtr<UDreamWidget> | Spin Box | - | read only | |
ValueTextNode | TObjectPtr<UDreamWidget> | Spin Box | - | read only | |
IncrementNode | TObjectPtr<UDreamWidget> | Spin Box | - | read only | |
IncrementLabelNode | TObjectPtr<UDreamWidget> | Spin Box | - | read only | |
DecrementBehaviour | TObjectPtr<UUIButton> | Spin Box | - | read only | |
IncrementBehaviour | TObjectPtr<UUIButton> | Spin Box | - | read only | |
InputBehaviour | TObjectPtr<UUITextInput> | Spin Box | - | read only |
Functions
| Function | Kind | Description |
|---|---|---|
void ClearMaxSliderValue() | callable | Clear Max Slider Value |
void ClearMaxValue() | callable | Clear Max Value |
void ClearMinSliderValue() | callable | The scrub falls back to the VALUE range again, which is what an unset slider bound means. |
void ClearMinValue() | callable | Takes the bottom away: the value may then be any number down to float's own floor. |
void Decrement() | callable | One step down, clamped -- what the [-] face does, callable without a pointer. |
bool GetAlwaysUsesDeltaSnap() | pure | Get Always Uses Delta Snap |
bool GetClearKeyboardFocusOnCommit() | pure | Get Clear Keyboard Focus on Commit |
float GetDelta() | pure | UMG's name for StepSize. One implementation, two spellings, no second truth. |
bool GetEnableSlider() | pure | Get Enable Slider |
UDreamUIFontData_BaseObject* GetFont() | pure | The typeface the number is drawn with -- UMG's Font, minus what FSlateFontInfo packs in beside it: the size is Style.FontSize and the outline belongs to the text style. Reads and writes Style.Font, so it obeys StyleSource like the rest of the look, and null means "leave the paragraph on the font it has", which is every spin box that exists today. |
EDreamUITextParagraphHorizontalAlign GetJustification() | pure | Get Justification |
TEnumAsByte<EVirtualKeyboardType::Type> GetKeyboardType() | pure | Get Keyboard Type |
int32 GetMaxFractionalDigits() | pure | Get Max Fractional Digits |
float GetMaxSliderValue() | pure | Get Max Slider Value |
float GetMaxValue() | pure | Get Max Value |
float GetMinDesiredWidth() | pure | Get Min Desired Width |
int32 GetMinFractionalDigits() | pure | Get Min Fractional Digits |
float GetMinSliderValue() | pure | Get Min Slider Value |
float GetMinValue() | pure | The RANGE, in UMG's shape: a bound is a value plus whether there is one at all. |
bool GetSelectAllTextOnCommit() | pure | Get Select All Text on Commit |
float GetSliderExponent() | pure | Get Slider Exponent |
float GetSliderMaxValue() | pure | Get Slider Max Value |
float GetSliderMinValue() | pure | The bottom of the range a DRAG sweeps: MinSliderValue when overridden, MinValue otherwise. |
float GetStepSize() | pure | Get Step Size |
FDreamSpinBoxStyle GetStyle() | pure | Get Style |
float GetValue() | pure | Get Value |
EVirtualKeyboardDismissAction GetVirtualKeyboardDismissAction() | pure | Get Virtual Keyboard Dismiss Action |
bool HasFiniteSliderRange() | pure | Whether the scrub has two real ends to sweep between. An open range cannot be dragged. |
void Increment() | callable | One step up, clamped -- what the [+] face does, callable without a pointer. |
bool IsSliderMoving() | pure | Whether a scrub is in progress right now. |
void SetAlwaysUsesDeltaSnap(bool bInAlwaysUsesDeltaSnap) | callable | Turning it on snaps the value the control is already holding, not just the next one. |
void SetClearKeyboardFocusOnCommit(bool bInClearKeyboardFocusOnCommit) | callable | Set Clear Keyboard Focus on Commit |
void SetDelta(float InDelta) | callable | Set Delta |
void SetEnableSlider(bool bInEnableSlider) | callable | Set Enable Slider |
void SetFont(UDreamUIFontData_BaseObject* InFont) | callable | Set Font |
void SetJustification(EDreamUITextParagraphHorizontalAlign InJustification) | callable | Set Justification |
void SetKeyboardType(TEnumAsByte<EVirtualKeyboardType::Type> InKeyboardType) | callable | Set Keyboard Type |
void SetMaxFractionalDigits(int32 InMaxFractionalDigits) | callable | Set Max Fractional Digits |
void SetMaxSliderValue(float InMaxSliderValue) | callable | Set Max Slider Value |
void SetMaxValue(float InMaxValue) | callable | Set Max Value |
void SetMinDesiredWidth(float InMinDesiredWidth) | callable | Set Min Desired Width |
void SetMinFractionalDigits(int32 InMinFractionalDigits) | callable | Re-spells the number that is already showing: a digit count nobody applied is not a format. |
void SetMinSliderValue(float InMinSliderValue) | callable | Set Min Slider Value |
void SetMinValue(float InMinValue) | callable | States a bottom, and clamps the current value into it. |
void SetSelectAllTextOnCommit(bool bInSelectAllTextOnCommit) | callable | Set Select All Text on Commit |
void SetSliderExponent(float InSliderExponent) | callable | Set Slider Exponent |
void SetStepSize(float InStepSize) | callable | Set Step Size |
void SetStyle(FDreamSpinBoxStyle InStyle) | callable | Set Style |
void SetValue(float InValue) | callable | Clamps into [MinValue, MaxValue]; broadcasts only when the clamped value differs. |
void SetVirtualKeyboardDismissAction(EVirtualKeyboardDismissAction InDismissAction) | callable | Set Virtual Keyboard Dismiss Action |
Events
| Event | Signature | Description |
|---|---|---|
OnValueChanged | void DreamSpinBoxValueChangedEvent__DelegateSignature(float Value) | Fired when the clamped value actually changes, whichever road changed it. |
OnValueCommitted | void DreamSpinBoxValueChangedEvent__DelegateSignature(float Value) | Fired when the value is COMMITTED -- a typed entry submitted, a step face clicked, a scrub let go of -- as distinct from every intermediate value a drag passes through. |
OnBeginSliderMovement | void DreamSpinBoxValueChangedEvent__DelegateSignature(float Value) | The scrub began. Pairs with OnEndSliderMovement around a run of OnValueChanged. |
OnEndSliderMovement | void DreamSpinBoxValueChangedEvent__DelegateSignature(float Value) | |
OnValueChangedBP | void DreamSpinBoxValueChangedEvent__DelegateSignature(float Value) | The <-> convention: two-way bindings synthesize their reverse route against this exact name, so a value control carries it alongside its spoken events. Fires with them. |
Compared with UMG
Every Blueprint-facing member of the UMG class, and where it went. adopt: same name, same meaning. map: here under another name or on another type. reject: deliberately absent, with the reason.
| UMG | Member | Status | Here | Note |
|---|---|---|---|---|
USpinBox | Value | adopt | Value | One clamp-assign-push-broadcast road, so the property, the field and the event can never disagree about the number. |
USpinBox | WidgetStyle | map | Style | FDreamSpinBoxStyle: the two step faces' colour set, the field's, plus sizes. Same role as FSpinBoxStyle, different shape. |
USpinBox | MinFractionalDigits | adopt | MinFractionalDigits | The setter re-spells the number already showing: a digit count nobody applied is not a format. |
USpinBox | MaxFractionalDigits | adopt | MaxFractionalDigits | |
USpinBox | bAlwaysUsesDeltaSnap | adopt | bAlwaysUsesDeltaSnap | Turning it on re-snaps the value the control is holding, not only the next one. |
USpinBox | bEnableSlider | adopt | bEnableSlider | Turning it off during a scrub ends that scrub and commits, rather than leaving a gesture nothing will finish. |
USpinBox | Delta | map | StepSize | The library's existing spelling, kept because .dui authors it. GetDelta/SetDelta carry the UMG name and forward to the same field. |
USpinBox | SliderExponent | adopt | SliderExponent | Setter clamps away from zero, the same floor the scrub arithmetic applies. |
USpinBox | Font | map | FDreamSpinBoxStyle::Font | A font DATA ASSET, not an FSlateFontInfo: the size is Style.FontSize and the outline belongs to the text style. GetFont/SetFont read and write it. The two step glyphs take the same one -- a minus sign in a different typeface from the number beside it is the one thing a shared style must not produce. Null leaves the paragraph on the font it has. |
USpinBox | Justification | adopt | Justification | EDreamUITextParagraphHorizontalAlign, the library's one paragraph-alignment enum. Default Center, which is where the built-in tree has always put the number. |
USpinBox | MinDesiredWidth | adopt | MinDesiredWidth | A floor under the control's own width and under what the value's paragraph asks a content-sized parent for. 0 = no opinion. |
USpinBox | KeyboardType | adopt | KeyboardType | Pushed to the typed-entry field's UUITextInput. Defaults to Number, which is the keyboard that field already derived from its DecimalNumber input type -- the same keyboard, said outright. |
USpinBox | VirtualKeyboardDismissAction | adopt | VirtualKeyboardDismissAction | Pushed to the field's behaviour; default TextCommitOnDismiss, which is what it did. |
USpinBox | ClearKeyboardFocusOnCommit | map | bClearKeyboardFocusOnCommit | b-prefixed. Default false, the same as UMG's. |
USpinBox | SelectAllTextOnCommit | map | bSelectAllTextOnCommit | Default TRUE where UMG's is false: a spin box is filled in one entry after another, and this is what it has always done. |
USpinBox | ForegroundColor | map | FDreamSpinBoxStyle::TextColor | Appearance lives in the style struct; the value text and the two step glyphs share it. |
USpinBox | OnValueChanged | adopt | OnValueChanged | Fires on every value a scrub passes through. |
USpinBox | OnValueCommitted | map | OnValueCommitted | Same moment; carries the value alone, without UMG's ETextCommit -- see EditableTextBox.json for why that enum is not spoken here. |
USpinBox | OnBeginSliderMovement | adopt | OnBeginSliderMovement | Carries the value the scrub started from, where UMG's carries nothing. Fires when the drag is recognised, and the travel before that moves no value, as in SSpinBox. |
USpinBox | OnEndSliderMovement | adopt | OnEndSliderMovement | |
USpinBox | GetValue | adopt | GetValue | |
USpinBox | SetValue | adopt | SetValue | |
USpinBox | GetMinFractionalDigits | adopt | GetMinFractionalDigits | |
USpinBox | SetMinFractionalDigits | adopt | SetMinFractionalDigits | |
USpinBox | GetMaxFractionalDigits | adopt | GetMaxFractionalDigits | |
USpinBox | SetMaxFractionalDigits | adopt | SetMaxFractionalDigits | |
USpinBox | GetAlwaysUsesDeltaSnap | adopt | GetAlwaysUsesDeltaSnap | |
USpinBox | SetAlwaysUsesDeltaSnap | adopt | SetAlwaysUsesDeltaSnap | |
USpinBox | GetDelta | adopt | GetDelta | Forwards to StepSize. |
USpinBox | SetDelta | adopt | SetDelta | Forwards to SetStepSize, which re-snaps the held value while delta snapping is on. |
USpinBox | GetMinValue | adopt | GetMinValue | Returns float's floor when the bound is switched off, exactly as UMG's does, because that is what every caller then clamps with. |
USpinBox | SetMinValue | adopt | SetMinValue | States the bound AND clamps the held value into it, so a range that moved under a value cannot leave it outside. |
USpinBox | ClearMinValue | adopt | ClearMinValue | bOverride_MinValue defaults to TRUE, unlike UMG's: every spin box that exists is clamped into 0..100 and an unbounded default would change all of them. |
USpinBox | GetMaxValue | adopt | GetMaxValue | |
USpinBox | SetMaxValue | adopt | SetMaxValue | |
USpinBox | ClearMaxValue | adopt | ClearMaxValue | |
USpinBox | GetMinSliderValue | adopt | GetMinSliderValue | The stated scrub bottom, or float's floor when there is none. GetSliderMinValue is the EFFECTIVE one, which falls back to the value range. |
USpinBox | SetMinSliderValue | adopt | SetMinSliderValue | |
USpinBox | ClearMinSliderValue | adopt | ClearMinSliderValue | The scrub falls back to the value range, which is what it did before there were slider bounds at all. |
USpinBox | GetMaxSliderValue | adopt | GetMaxSliderValue | |
USpinBox | SetMaxSliderValue | adopt | SetMaxSliderValue | |
USpinBox | ClearMaxSliderValue | adopt | ClearMaxSliderValue | |
USpinBox | SetForegroundColor | map | FDreamSpinBoxStyle::TextColor | Moves through SetStyle or the project sheet; a second setter writing the inline struct would be silently inert whenever StyleSource is the sheet. |
USpinBox | MinValue | adopt | MinValue | With bOverride_MinValue beside it, the same pair UMG uses. Default ticked, because every existing spin box is bounded. |
USpinBox | MaxValue | adopt | MaxValue | |
USpinBox | MinSliderValue | adopt | MinSliderValue | Unticked by default: the scrub sweeps the value range unless someone narrows it. |
USpinBox | MaxSliderValue | adopt | MaxSliderValue |