DreamGUI
类参考

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 -> HandleCount

Properties

NameTypeCategoryIn the details panelFrom BlueprintDescription
StyleFDreamSpinBoxStyleSpin BoxyesGetStyle / SetStyleThis 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.
ValuefloatSpin BoxyesGetValue / SetValueAuthored value in; the control's own thereafter. A property so .dui and bindings can see it.
MinValuefloatSpin BoxyesGetMinValue / SetMinValue
MaxValuefloatSpin BoxyesGetMaxValue / SetMaxValue
StepSizefloatSpin BoxyesGetStepSize / SetStepSizeWhat one click of a step face adds or removes, before clamping. UMG calls it Delta.
MinSliderValuefloatSpin BoxyesGetMinSliderValue / SetMinSliderValue
MaxSliderValuefloatSpin BoxyesGetMaxSliderValue / SetMaxSliderValue
SliderExponentfloatSpin BoxyesGetSliderExponent / SetSliderExponentHow 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.
bEnableSliderboolSpin BoxyesGetEnableSlider / SetEnableSliderWhether dragging the field scrubs the value at all -- UMG's EnableSlider.
bAlwaysUsesDeltaSnapboolSpin BoxyesGetAlwaysUsesDeltaSnap / SetAlwaysUsesDeltaSnapEvery 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.
MinFractionalDigitsint32Spin BoxyesGetMinFractionalDigits / SetMinFractionalDigitsHow the number is SPELLED -- UMG's MinFractionalDigits / MaxFractionalDigits.
MaxFractionalDigitsint32Spin BoxyesGetMaxFractionalDigits / SetMaxFractionalDigits
bClearKeyboardFocusOnCommitboolSpin BoxyesGetClearKeyboardFocusOnCommit / SetClearKeyboardFocusOnCommitStop editing the field when the value is committed -- UMG's ClearKeyboardFocusOnCommit.
bSelectAllTextOnCommitboolSpin BoxyesGetSelectAllTextOnCommit / SetSelectAllTextOnCommitSelect 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.
JustificationEDreamUITextParagraphHorizontalAlignSpin BoxyesGetJustification / SetJustificationHow the number sits across the field -- UMG's Justification. Centre by default, which is where the built-in tree has always put it.
MinDesiredWidthfloatSpin BoxyesGetMinDesiredWidth / SetMinDesiredWidthA 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.
KeyboardTypeTEnumAsByte<EVirtualKeyboardType::Type>Spin BoxyesGetKeyboardType / SetKeyboardTypeWhich virtual keyboard the typed-entry field summons. Default derives it from the field's type.
VirtualKeyboardDismissActionEVirtualKeyboardDismissActionSpin BoxyesGetVirtualKeyboardDismissAction / SetVirtualKeyboardDismissActionWhat dismissing that keyboard means -- pushed straight to the field's behaviour.
DecrementNodeTObjectPtr<UDreamWidget>Spin Box-read only
DecrementLabelNodeTObjectPtr<UDreamWidget>Spin Box-read only
FieldNodeTObjectPtr<UDreamWidget>Spin Box-read only
ClipNodeTObjectPtr<UDreamWidget>Spin Box-read only
ValueTextNodeTObjectPtr<UDreamWidget>Spin Box-read only
IncrementNodeTObjectPtr<UDreamWidget>Spin Box-read only
IncrementLabelNodeTObjectPtr<UDreamWidget>Spin Box-read only
DecrementBehaviourTObjectPtr<UUIButton>Spin Box-read only
IncrementBehaviourTObjectPtr<UUIButton>Spin Box-read only
InputBehaviourTObjectPtr<UUITextInput>Spin Box-read only

Functions

FunctionKindDescription
void ClearMaxSliderValue()callableClear Max Slider Value
void ClearMaxValue()callableClear Max Value
void ClearMinSliderValue()callableThe scrub falls back to the VALUE range again, which is what an unset slider bound means.
void ClearMinValue()callableTakes the bottom away: the value may then be any number down to float's own floor.
void Decrement()callableOne step down, clamped -- what the [-] face does, callable without a pointer.
bool GetAlwaysUsesDeltaSnap()pureGet Always Uses Delta Snap
bool GetClearKeyboardFocusOnCommit()pureGet Clear Keyboard Focus on Commit
float GetDelta()pureUMG's name for StepSize. One implementation, two spellings, no second truth.
bool GetEnableSlider()pureGet Enable Slider
UDreamUIFontData_BaseObject* GetFont()pureThe 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()pureGet Justification
TEnumAsByte<EVirtualKeyboardType::Type> GetKeyboardType()pureGet Keyboard Type
int32 GetMaxFractionalDigits()pureGet Max Fractional Digits
float GetMaxSliderValue()pureGet Max Slider Value
float GetMaxValue()pureGet Max Value
float GetMinDesiredWidth()pureGet Min Desired Width
int32 GetMinFractionalDigits()pureGet Min Fractional Digits
float GetMinSliderValue()pureGet Min Slider Value
float GetMinValue()pureThe RANGE, in UMG's shape: a bound is a value plus whether there is one at all.
bool GetSelectAllTextOnCommit()pureGet Select All Text on Commit
float GetSliderExponent()pureGet Slider Exponent
float GetSliderMaxValue()pureGet Slider Max Value
float GetSliderMinValue()pureThe bottom of the range a DRAG sweeps: MinSliderValue when overridden, MinValue otherwise.
float GetStepSize()pureGet Step Size
FDreamSpinBoxStyle GetStyle()pureGet Style
float GetValue()pureGet Value
EVirtualKeyboardDismissAction GetVirtualKeyboardDismissAction()pureGet Virtual Keyboard Dismiss Action
bool HasFiniteSliderRange()pureWhether the scrub has two real ends to sweep between. An open range cannot be dragged.
void Increment()callableOne step up, clamped -- what the [+] face does, callable without a pointer.
bool IsSliderMoving()pureWhether a scrub is in progress right now.
void SetAlwaysUsesDeltaSnap(bool bInAlwaysUsesDeltaSnap)callableTurning it on snaps the value the control is already holding, not just the next one.
void SetClearKeyboardFocusOnCommit(bool bInClearKeyboardFocusOnCommit)callableSet Clear Keyboard Focus on Commit
void SetDelta(float InDelta)callableSet Delta
void SetEnableSlider(bool bInEnableSlider)callableSet Enable Slider
void SetFont(UDreamUIFontData_BaseObject* InFont)callableSet Font
void SetJustification(EDreamUITextParagraphHorizontalAlign InJustification)callableSet Justification
void SetKeyboardType(TEnumAsByte<EVirtualKeyboardType::Type> InKeyboardType)callableSet Keyboard Type
void SetMaxFractionalDigits(int32 InMaxFractionalDigits)callableSet Max Fractional Digits
void SetMaxSliderValue(float InMaxSliderValue)callableSet Max Slider Value
void SetMaxValue(float InMaxValue)callableSet Max Value
void SetMinDesiredWidth(float InMinDesiredWidth)callableSet Min Desired Width
void SetMinFractionalDigits(int32 InMinFractionalDigits)callableRe-spells the number that is already showing: a digit count nobody applied is not a format.
void SetMinSliderValue(float InMinSliderValue)callableSet Min Slider Value
void SetMinValue(float InMinValue)callableStates a bottom, and clamps the current value into it.
void SetSelectAllTextOnCommit(bool bInSelectAllTextOnCommit)callableSet Select All Text on Commit
void SetSliderExponent(float InSliderExponent)callableSet Slider Exponent
void SetStepSize(float InStepSize)callableSet Step Size
void SetStyle(FDreamSpinBoxStyle InStyle)callableSet Style
void SetValue(float InValue)callableClamps into [MinValue, MaxValue]; broadcasts only when the clamped value differs.
void SetVirtualKeyboardDismissAction(EVirtualKeyboardDismissAction InDismissAction)callableSet Virtual Keyboard Dismiss Action

Events

EventSignatureDescription
OnValueChangedvoid DreamSpinBoxValueChangedEvent__DelegateSignature(float Value)Fired when the clamped value actually changes, whichever road changed it.
OnValueCommittedvoid 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.
OnBeginSliderMovementvoid DreamSpinBoxValueChangedEvent__DelegateSignature(float Value)The scrub began. Pairs with OnEndSliderMovement around a run of OnValueChanged.
OnEndSliderMovementvoid DreamSpinBoxValueChangedEvent__DelegateSignature(float Value)
OnValueChangedBPvoid 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.

UMGMemberStatusHereNote
USpinBoxValueadoptValueOne clamp-assign-push-broadcast road, so the property, the field and the event can never disagree about the number.
USpinBoxWidgetStylemapStyleFDreamSpinBoxStyle: the two step faces' colour set, the field's, plus sizes. Same role as FSpinBoxStyle, different shape.
USpinBoxMinFractionalDigitsadoptMinFractionalDigitsThe setter re-spells the number already showing: a digit count nobody applied is not a format.
USpinBoxMaxFractionalDigitsadoptMaxFractionalDigits
USpinBoxbAlwaysUsesDeltaSnapadoptbAlwaysUsesDeltaSnapTurning it on re-snaps the value the control is holding, not only the next one.
USpinBoxbEnableSlideradoptbEnableSliderTurning it off during a scrub ends that scrub and commits, rather than leaving a gesture nothing will finish.
USpinBoxDeltamapStepSizeThe library's existing spelling, kept because .dui authors it. GetDelta/SetDelta carry the UMG name and forward to the same field.
USpinBoxSliderExponentadoptSliderExponentSetter clamps away from zero, the same floor the scrub arithmetic applies.
USpinBoxFontmapFDreamSpinBoxStyle::FontA 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.
USpinBoxJustificationadoptJustificationEDreamUITextParagraphHorizontalAlign, the library's one paragraph-alignment enum. Default Center, which is where the built-in tree has always put the number.
USpinBoxMinDesiredWidthadoptMinDesiredWidthA floor under the control's own width and under what the value's paragraph asks a content-sized parent for. 0 = no opinion.
USpinBoxKeyboardTypeadoptKeyboardTypePushed 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.
USpinBoxVirtualKeyboardDismissActionadoptVirtualKeyboardDismissActionPushed to the field's behaviour; default TextCommitOnDismiss, which is what it did.
USpinBoxClearKeyboardFocusOnCommitmapbClearKeyboardFocusOnCommitb-prefixed. Default false, the same as UMG's.
USpinBoxSelectAllTextOnCommitmapbSelectAllTextOnCommitDefault TRUE where UMG's is false: a spin box is filled in one entry after another, and this is what it has always done.
USpinBoxForegroundColormapFDreamSpinBoxStyle::TextColorAppearance lives in the style struct; the value text and the two step glyphs share it.
USpinBoxOnValueChangedadoptOnValueChangedFires on every value a scrub passes through.
USpinBoxOnValueCommittedmapOnValueCommittedSame moment; carries the value alone, without UMG's ETextCommit -- see EditableTextBox.json for why that enum is not spoken here.
USpinBoxOnBeginSliderMovementadoptOnBeginSliderMovementCarries 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.
USpinBoxOnEndSliderMovementadoptOnEndSliderMovement
USpinBoxGetValueadoptGetValue
USpinBoxSetValueadoptSetValue
USpinBoxGetMinFractionalDigitsadoptGetMinFractionalDigits
USpinBoxSetMinFractionalDigitsadoptSetMinFractionalDigits
USpinBoxGetMaxFractionalDigitsadoptGetMaxFractionalDigits
USpinBoxSetMaxFractionalDigitsadoptSetMaxFractionalDigits
USpinBoxGetAlwaysUsesDeltaSnapadoptGetAlwaysUsesDeltaSnap
USpinBoxSetAlwaysUsesDeltaSnapadoptSetAlwaysUsesDeltaSnap
USpinBoxGetDeltaadoptGetDeltaForwards to StepSize.
USpinBoxSetDeltaadoptSetDeltaForwards to SetStepSize, which re-snaps the held value while delta snapping is on.
USpinBoxGetMinValueadoptGetMinValueReturns float's floor when the bound is switched off, exactly as UMG's does, because that is what every caller then clamps with.
USpinBoxSetMinValueadoptSetMinValueStates the bound AND clamps the held value into it, so a range that moved under a value cannot leave it outside.
USpinBoxClearMinValueadoptClearMinValuebOverride_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.
USpinBoxGetMaxValueadoptGetMaxValue
USpinBoxSetMaxValueadoptSetMaxValue
USpinBoxClearMaxValueadoptClearMaxValue
USpinBoxGetMinSliderValueadoptGetMinSliderValueThe stated scrub bottom, or float's floor when there is none. GetSliderMinValue is the EFFECTIVE one, which falls back to the value range.
USpinBoxSetMinSliderValueadoptSetMinSliderValue
USpinBoxClearMinSliderValueadoptClearMinSliderValueThe scrub falls back to the value range, which is what it did before there were slider bounds at all.
USpinBoxGetMaxSliderValueadoptGetMaxSliderValue
USpinBoxSetMaxSliderValueadoptSetMaxSliderValue
USpinBoxClearMaxSliderValueadoptClearMaxSliderValue
USpinBoxSetForegroundColormapFDreamSpinBoxStyle::TextColorMoves through SetStyle or the project sheet; a second setter writing the inline struct would be silently inert whenever StyleSource is the sheet.
USpinBoxMinValueadoptMinValueWith bOverride_MinValue beside it, the same pair UMG uses. Default ticked, because every existing spin box is bounded.
USpinBoxMaxValueadoptMaxValue
USpinBoxMinSliderValueadoptMinSliderValueUnticked by default: the scrub sweeps the value range unless someone narrows it.
USpinBoxMaxSliderValueadoptMaxSliderValue

本页目录