How to make SMultiLineEditableText work with SScrollBar

I try to make the scrollbar to work on this control without succes.

Here the code I am using:

+ SOverlay::Slot()
					.VAlign(VAlign_Fill)
					.HAlign(HAlign_Right)
					.Padding(12.0f)
					[
						SAssignNew(ScrollBar, SScrollBar)
						.Orientation(EOrientation::Orient_Vertical)
						.Visibility(EVisibility::Visible)
						.AlwaysShowScrollbar(true)
					]
					+ SOverlay::Slot()
					.VAlign(VAlign_Bottom)
					.HAlign(HAlign_Fill)
					.Padding(20.0f, 20.0f, 28.0f, 20.0f)
					[
						SAssignNew(OutputTextBlock, SMultiLineEditableText)
						.TextStyle(&SUWindowsStyle::Get().GetWidgetStyle<FTextBlockStyle>(TEXT("Console.OutputFont")))
						.AutoWrapText(true)
						.IsReadOnly(true)
						.VScrollBar(ScrollBar)
					]

The scrollbar is show but will not get updated by SMultiLineEditableText. it’s like the scrollbar is stuck on top.
If I fill SMultiLineEditableText to be able to scroll, it will not update the scrollbar, always stay on top with same size.

Also it is impossible to me to update the scrollbar since SMultiLineEditableText have nothing to return like how many lines etc… so it need to be handled by SMultiLineEditableText not be me!

Unless they are something I dont understand, please help!

so far by re-validating the code of SMultiLineEditableText it seam the control does not care much about the VScrollBar object. Never the code call VScrollBar to change or update value, only forward scrolling event…

The size and offset of both scrollbars are updated in SMultiLineEditableText::Tick. You can see that the bottom of that function will update both HScrollBar and VScrollBar.

I’m not sure an overlay is the correct container to use here (although I haven’t yet worked out exactly why).

The scrolling works correctly when using a SHorizontalBox:

ScrollBar = SNew(SScrollBar)
	.Orientation(EOrientation::Orient_Vertical)
	.Visibility(EVisibility::Visible)
	.AlwaysShowScrollbar(true);

// ...

+SHorizontalBox::Slot()
.VAlign(VAlign_Fill)
.HAlign(HAlign_Fill)
.Padding(20.0f, 20.0f, 28.0f, 20.0f)
[
	SAssignNew(OutputTextBlock, SMultiLineEditableText)
	.TextStyle(&SUWindowsStyle::Get().GetWidgetStyle<FTextBlockStyle>(TEXT("Console.OutputFont")))
	.AutoWrapText(true)
	.IsReadOnly(true)
	.VScrollBar(ScrollBar)
]

+SHorizontalBox::Slot()
.VAlign(VAlign_Fill)
.HAlign(HAlign_Right)
.Padding(12.0f)
[
	ScrollBar.ToSharedRef()
]

Is there a reason you’re not just using SMultiLineEditableTextBox? That will add the scroll bars for you automatically.

Hmm, that’s weird. I’m able to click and drag the scrollbar just fine using the code I posted above.

Is it possible you have a widget overlapping your scrollbar? The widget reflector should be able to show you if you do.

Great thanks, that do the trick.

the scrollbar is updated, the only weird thing is when i try to scroll using the scrollbar with the mouse, nothing append, i can click under the scroll to scroll like by page but i can not actually push the button to drag the scrollbar button
. and the scroll get light up (hovered style) is show…

ok i traced in scrollbar code and they are a bug at least with 4.9.1

This is not called ExecuteOnUserScrolled( MyGeometry, MouseEvent );

only called if i dont push the button LOL. so it like the code is corrected on your side :slight_smile:

its maybe not that too… I tryed to correct it without success, i need to take a more deeper look, I bet you are not testing on 4.9.1 anyway :slight_smile:

ok i find out its my mistake since its my custom console slate dialog to fake the real console i was handling the case when the focus was going out and put it back to the inputbox, but that make the scrollbar lose focus as soon i pushed the button!