I’m trying to create a dialog that contains text. The dialog may contain more or less text depending on the situation. Therefore I need a text block which is multiline(not editable). Is that currently possible with UMG?
Hi TommyBear, yes that’s possible now. Except for the centering on multiple lines. The centering is done based on the size of the whole textblock. So it wont center individual lines. Sizing for elements is decided by their parent. So the text has a desired size, but the border would tell the text how much room it gets. Same goes for the border element, the border can only auto size if the container it is in permits it. So if it’s inside a canvas the canvas tells the border how big it can be, even if it wants to take up more room. So you’d need to use a flow layout panel, like placing the border inside a Vertical or Horizontal box, which will allow the border to take the room it needs but automatically align it based on the alignment rules you’ve set.
Hey Nick! Thanks for the answer. So just to clarify (because I’m not in front of Unreal right now), I can achieve the following(using the method you describe):
Line by line centering is not supported in the text block
I can achieve a multi-line output in a textblock
I can pump a string into this text block and have a border resize to fit the text block?
The parent textblock can then be centered vertically and horizontally?
I’m not seeing multiple lines in the textblock. It is not wrapping. Thanks heaps for the answers!
EDIT: Yeah the main issues here for me are basically:
The textblock does not support multi-line
I need the border around the text to resize to fit the text
Yup your summary is the gist of it. By default the textblock wont wrap, you need to enable autowrap text on it. You can also pick a specific width to begin wrapping at.
That is just awesome Jamie!! Thank you so much. Just quickly. To get the dialog automatically recentering as it resizes, should I be putting it in a vertical/horzontal panel and then centering the parent?
It’s the HAlign and VAlign of the parent slot that affects the children of that slot.
I’m not 100% sure how this translates into UMG terminology, but you’d set the parent slot of the text block to be centered, which I think is what you said.
If you do need proper center justification of your text, the rich-text block does support justification, although it’s a bit more heavy weight and perhaps not as flexible. Hopefully this situation will improve for 4.5 though.