I’m trying to add text widgets to the bottom of a scroll box and have it always scroll so that everything is visible. When the scroll box is filled and I add a new line of text that is long enough to wrap, it only scrolls to show the top of it.
It’s an old issue with the autowrap and prepass, in this case the text lags behind the widget a little bit as it does not know how much space is (will be) available. You can easily observe it if you add a delay of 0.05 just before ScrollToEnd. This is not a solution, though as the text will most likely start to flicker quite a bit as it tries to auto-adjust in its new container. But it should scroll to the bottom.
One way to solve it is to manually set your TextLine’s TextBlock’s *WrapTextAt *value to the width of the target container (whatever is housing the Scrollbox I guess). This way, the text automagically knows its future size. The downside here is that one cannot adjust this value dynamically - so you need to know the size of the container you’re putting the widget in in advance - not an issue in most cases.
Another potential solution is to use ForceLayoutPrepass (node) on the text just after adding it to the scrollbox (I think) - it’s been at least a year since I used it last time and I can’t really remember if I ever got it to work. The above method definitely works, though.
The whole things is a limitation in UMG, not really a bug as far as I know.
But you’re adding widgets to a canvas, not to a scrollbox. Add Child to Scrollbox instead, no need to Set Position then. You wouldn’t be able to anyway.
Thanks! Ok, I use the Add Child and show the whole content successfully.
But I curious about how to adjust the content postion.
Can I change the display position?
You should be able to adjust padding / spacing. Have a look at the details of the Scroll Box’ details panel. And, also, each slot the scroll box creates can be padded as well.
Another method is to create children widgets that require no padding, they may already be given a transparent border and / or padding.