How to make text in an overlay extend from right to left?

I have an overlay with a text block, image, and button that all size to the length of the text, but I want them to extend from right to left, so the text is justified on the right. No matter what justification, alignment, or flow settings I use, it doesn’t change. It always extends from left to right. Does anyone know how to do this?

Thanks in advance

No, that’s just a text block inside of a canvas. I need a text block justified to the right that is a child of an overlay widget inside of a canvas.

310249-0039.png

I need a text block justified to the
right that is a child of an overlay
widget inside of a canvas.

That’s what slots are for:

But then how do I make the image and button always stay the same size as the text?

You’re probably after a double overlay:

The outer overlay is flagged as Size To Content, this desired size is provided by the inner overlay being stretched by the text box. The image and button are set to Fill and simply conform.

This will not work too well if the image is larger than the text. Hopefully that’s not an issue, do tell if it is.

Not sure if I follow what you’re trying to achieve, though. If the above does not help much, consider dropping a mock of of the end result.

I have an outer overlay with size to content set, an inner overlay with alignment settings to the right, an image and button set to fill, and a text block set to align and justify to the right, and it still hasn’t changed anything

Show us what you expect from the end result. My setup followed your description but it seems it is not what you need.

You’ll need to clarify some more.

So my text is a variable that’s bound to C++. I want it to be on the right side of the canvas, and extend from right to left, so the right border never changes. I also want to have a button and image underneath the text block that size to the same size as the text.

That’s exactly what I have above, no? Even a single overlay anchored to the right would work here. I though you were after something more complex.

Can you confirm the effect you see in my image is the end result you’re after?

If when you continue typing into those text blocks, it moves the text left, then yes. But it didn’t work for me. What exactly did you set each widget as?

You can ctrl+shift+click this to set the anchors and alignment automatically for the overlay that sits in the canvas.

Image & Button H/V alignement are set to Fill to they conform to whatever the text size there is.

No need to worry about the text itself, Size to Content of the canvas’s slot will take care of everything anyway.


But again, if the button or the image are larger than the text (because this can be overridden), then they will start dictating the size of the overlay.

It finally works, thank you!