DreamGUI
类参考

UDreamScrollBar

A scroll bar whose hierarchy is code, not an asset.

本页由 DreamGUIReferenceDocs commandlet 从反射生成,正文是头文件注释的原文(英文),所以不翻译——这样它永远和代码一致。概念讲解见核心概念。

Inherits from UDreamUIControl.

Declared in Public/Controls/DreamScrollBar.h.

A scroll bar whose hierarchy is code, not an asset.

Two nodes: a track, and a handle inside it. BP_HorizontalScrollbar and BP_VerticalScrollbar are two assets because an asset cannot branch on a property; this is one control because code can, and Direction is the only thing they disagreed about. The handle's parent IS the track, which is what the behaviour measures the value against -- a scroll bar handle rides the whole track (unlike a slider's, which is inset by its own size), because its LENGTH already shrinks the travel.

WHAT THIS CLASS STOPPED DOING

It used to carry a UUIScrollbar SUBCLASS and re-place the handle itself, because the component wrote ratio anchors and exposed neither Handle nor DirectionType to anything but a details panel. All three of those are fixed at the source now: UUIScrollbar places the handle with absolute geometry, takes both writes through public setters, and owns the minimum-length floor together with the drag scale it has to agree with. What is left here is what a control is for -- style, properties a designer and a <-> binding can reach, and the link to a scroll view.

A bar with no scroll view is a value control in its own right: its value is a position from 0 to 1 and HandleSize is how much of the track the handle covers. Point it at a UUIScrollView and both numbers become the view's -- progress in, progress out -- which is how the standalone bar drives a scroll box.

Clicking the track off the handle puts the handle's CENTRE where the track was clicked, clamped to the ends, and a drag from that press carries on from there -- SScrollBar's behaviour. Until this was checked against the 5.8 source a track click paged one handle length toward the pointer (Unity's behaviour), so existing screens now jump where they used to step.

Neither the track nor the arrows are a place the pad's navigation lands or Tab stops, which is how SScrollBar behaves: the track's UUIScrollbar starts with bCanNavigateHere off (see its class comment) and the arrows are made the same in WireParts. The keys and the stick scroll whatever the bar follows through the focused control instead.

Properties

NameTypeCategoryIn the details panelFrom BlueprintDescription
StyleFDreamScrollBarStyleScroll BaryesGetStyle / 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. A scroll box overwrites it wholesale with its own style's Bar, so one style edit dresses the box and its bar together.
DirectionEUIScrollbarDirectionTypeScroll BaryesGetDirection / SetDirectionWhich way it runs, and which end is zero. One property instead of two Blueprint assets.
ValuefloatScroll BaryesGetValue / SetValueAuthored position in; mirror of the behaviour's out. A property so .dui and bindings can see it.
HandleSizefloatScroll BaryesGetHandleSize / SetHandleSizeHow much of the track the handle covers, 0 to 1 -- the visible fraction of whatever is being scrolled. A bar attached to a scroll view has this rewritten from the view on every push; a quarter is what a bare bar shows so it reads as a bar and not as a filled rail.
bAlwaysShowScrollbarboolScroll BaryesGetAlwaysShowScrollbar / SetAlwaysShowScrollbarWhether the bar stays put with nothing to scroll -- UMG's bAlwaysShowScrollbar.
bAlwaysShowScrollbarTrackboolScroll BaryesGetAlwaysShowScrollbarTrack / SetAlwaysShowScrollbarTrackWhether the TRACK survives the bar hiding itself -- UMG's bAlwaysShowScrollbarTrack, and the groove a desktop scroll bar leaves behind when its thumb has nothing to say.
MinHandleLengthfloatScroll BaryesGetMinHandleLength / SetMinHandleLengthFloor on the handle's drawn length, in local units. Pushed into the behaviour, which applies it to the drawn length and to the drag scale together -- a handle drawn longer than the fraction it drags with would run at the wrong rate for the whole of a long list.
NavigationChangeIntervalfloatScroll BaryesGetNavigationChangeInterval / SetNavigationChangeIntervalHow far one navigation press moves the value.
bShowArrowsboolScroll BaryesGetShowArrows / SetShowArrowsA step button at each end of the track -- the desktop scroll bar's arrows.
ArrowStepSizefloatScroll BaryesGetArrowStepSize / SetArrowStepSizeHow far one arrow click moves the value, as a fraction of the whole range.
AcceptedMouseButtonsint32Scroll BaryesGetAcceptedMouseButtons / SetAcceptedMouseButtonsWHICH mouse buttons move this bar -- a bitmask over EDreamUIMouseButtonType, the left button alone by default, which is SScrollBar's rule: its OnMouseButtonDown answers EKeys::LeftMouseButton and nothing else, so a right drag on the handle or a right click on the track leaves the bar where it is and goes on to whatever is behind it. The two arrows answer the same buttons.
TrackNodeTObjectPtr<UDreamWidget>Scroll Bar-read only
HandleNodeTObjectPtr<UDreamWidget>Scroll Bar-read only
BarBehaviourTObjectPtr<UUIScrollbar>Scroll Bar-read only
ArrowStartNodeTObjectPtr<UDreamWidget>Scroll Bar-read onlyThe step buttons. Present in the built-in tree and asleep until bShowArrows wakes them.
ArrowEndNodeTObjectPtr<UDreamWidget>Scroll Bar-read only
ArrowStartGlyphNodeTObjectPtr<UDreamWidget>Scroll Bar-read only
ArrowEndGlyphNodeTObjectPtr<UDreamWidget>Scroll Bar-read only
ArrowStartBehaviourTObjectPtr<UUIButton>Scroll Bar-read only
ArrowEndBehaviourTObjectPtr<UUIButton>Scroll Bar-read only

Functions

FunctionKindDescription
int32 GetAcceptedMouseButtons()pureGet Accepted Mouse Buttons
bool GetAlwaysShowScrollbar()pureGet Always Show Scrollbar
bool GetAlwaysShowScrollbarTrack()pureGet Always Show Scrollbar Track
float GetArrowStepSize()pureGet Arrow Step Size
EUIScrollbarDirectionType GetDirection()pureGet Direction
float GetHandleSize()pureGet Handle Size
float GetMinHandleLength()pureGet Min Handle Length
float GetNavigationChangeInterval()pureGet Navigation Change Interval
UUIScrollView* GetScrollView()pureGet Scroll View
bool GetShowArrows()pureGet Show Arrows
FDreamScrollBarStyle GetStyle()pureBy value, not by reference: a UFUNCTION return has to be a value, and a style is a small struct.
float GetValue()pureGet Value
bool IsHorizontal()pureTrue for LeftToRight and RightToLeft. Everything axis-dependent in here asks this.
void RefreshFromScrollView()callableTake position and visible fraction from the attached view. Called for you whenever it moves.
void SetAcceptedMouseButtons(int32 InAcceptedMouseButtons)callableWrites the bitmask and pushes it onto the bar's behaviours at once -- the next press consults it.
void SetAlwaysShowScrollbar(bool bInAlwaysShow)callableSet Always Show Scrollbar
void SetAlwaysShowScrollbarTrack(bool bInAlwaysShow)callableSet Always Show Scrollbar Track
void SetArrowStepSize(float InStep)callableSet Arrow Step Size
void SetDirection(EUIScrollbarDirectionType InDirection)callableWhich way it runs decides the whole rect, so this is a style push and not a field write.
void SetHandleSize(float InFraction)callableSet Handle Size
void SetMinHandleLength(float InLength)callableSet Min Handle Length
void SetNavigationChangeInterval(float InInterval)callableSet Navigation Change Interval
void SetScrollView(UUIScrollView* InView)callableDrive a scroll view with this bar, both ways.
void SetShowArrows(bool bInShowArrows)callableWakes or sleeps the arrows AND re-insets the track, which is why it is a whole style push.
void SetState(float InOffsetFraction, float InThumbSizeFraction, bool bInCollapseIfNecessary)callablePosition and visible fraction in one call -- UMG's SetState, and the shape a scroll view actually pushes: the two numbers always move together, and writing them one at a time lays the handle out twice for one change.
void SetStyle(FDreamScrollBarStyle InStyle)callableReplace the whole look and re-push it -- thickness and margin are geometry, not paint.
void SetValue(float InValue)callableSet Value
void SetValueWithoutNotify(float InValue)callableFor a follower: moves the handle without telling anyone, so a two-way link cannot ring.

Events

EventSignatureDescription
OnValueChangedvoid DreamScrollBarValueChangedEvent__DelegateSignature(float Value)Re-broadcast from the behaviour, so a consumer binds to the control, not to a part of it.
OnValueChangedBPvoid DreamScrollBarValueChangedEvent__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
UScrollBarWidgetStylemapStyleFDreamScrollBarStyle, resolved against the project style sheet. Get/SetStyle.
UScrollBarbAlwaysShowScrollbaradoptbAlwaysShowScrollbarDefault true, not UMG's false: this bar has always drawn whatever it was placed into, and a screen whose bar vanished the moment its list fitted would be a layout that changed under everyone. Only a bar attached to a scroll view can hide itself -- a bare bar is a value control with no 'nothing to scroll' state.
UScrollBarbAlwaysShowScrollbarTrackadoptbAlwaysShowScrollbarTrackKeeps the bar on screen with its handle asleep. Only consulted while bAlwaysShowScrollbar is off and the attached view fits.
UScrollBarOrientationmapDirectionEUIScrollbarDirectionType, which says which way it runs AND which end is zero -- four answers where UMG's EOrientation has two. Get/SetDirection.
UScrollBarThicknessmapFDreamScrollBarStyle::ThicknessIn the style, because it is what the bar is drawn from. A float: a bar has one thickness across its own axis, and its length is whatever it is scrolling.
UScrollBarPaddingmapFDreamScrollBarStyle::BarPaddingNew style field, default FMargin(0) = what every bar has drawn. Spent on the bar's rect, not the track's, so the track still reaches both ends of what the bar spans.
UScrollBarSetStateadoptSetStatePosition and visible fraction in one call, which is the shape a scroll view actually pushes: writing them one at a time lays the handle out twice for one change. The pointer moves the position only with the mouse buttons in AcceptedMouseButtons -- the left one alone by default, which is SScrollBar's rule (its OnMouseButtonDown tests EKeys::LeftMouseButton); AcceptedMouseButtons is this control's own knob, as on UDreamButton, and a touch always counts. A click on the track off the handle puts the handle's centre there, as SScrollBar's ExecuteOnUserScrolled does, rather than paging.

本页目录