How do i scroll to the end of a scrollbox in any circumstances ?

Hi,

I’m trying to get the last widget of a vertical box inside a scrollbox always visible.

The usual functions:


ScrollBox_Journal->ScrollToEnd();
ScrollBox_Journal->ScrollWidgetIntoView(VerticalBox_Journal->GetChildAt(VerticalBox_Journal->GetChildrenCount() - 1), true);

work only as long as the the vertical box is horizontally stretched enough so that there’s no text autowrap going on:

ScrollOK.png

But as soon as the autowrap kicks in, the scrolling, when requested by those functions (it works well with the mouse of course) doesn’t go to the end:

ScrollKO.png

I have tried to play with the padding and the EDescendantScrollDestination options, but no success so far.
I’ve even tried more fancy things, like adding an extra invisible widget below the vertical box and aiming at it, but to no avail.

Anyone has a trick to make this work in all circumstances ?

Thanks
Cedric

Always as in always always? Then an easy solution would be to just have the last element be outside of the list itself, in a separate widget holder under the vertical box.

Not a bad idea at all, didn’t think about that, thanks !!

Total hack job, but in our code we call “ScrollBox->ScrollToEnd()” on 5 successive ticks whenever the chat log needs to scroll for new entries.

Not sure why ScrollToEnd() doesn’t always work when called once (suspect it has to do with Render and Game separate threads) but this workaround is simple and works.

Oh cool idea, i tried to call it with a delay (didn’t work), but i didn’t think about calling it several times.
Thanks :slight_smile:

I think (very much conjecture) it may be that when you add a new item to a UMG element, it will update element positions on a Tick(), but that update might cascade to further changes on later Ticks().

The “5 updates” number is via experimentation. We noticed only 2-3 would sometimes not work.