x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

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!

Product Version: UE 4.9
Tags:
more ▼

asked Sep 28 '15 at 09:16 PM in C++ Programming

avatar image

labidus
13 1 4 5

avatar image labidus Sep 28 '15 at 09:29 PM

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

avatar image Jamie Dale STAFF Sep 28 '15 at 09:57 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Sep 28 '15 at 10:29 PM

avatar image

Jamie Dale STAFF
7.4k 176 66 304

avatar image labidus Sep 28 '15 at 10:39 PM

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

avatar image Jamie Dale STAFF Sep 28 '15 at 11:00 PM

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.

avatar image labidus Sep 28 '15 at 11:25 PM

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 :)

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 :)

avatar image labidus Sep 28 '15 at 11:35 PM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question