|Category||Farming Simulator 19|
|Tim Derks (timmiej93)||30.01.2020 21:02|
|I'm creating a custom GUI, where I'd like to have a view containing multiple text elements. These should all just follow each other vertically, with some margin in between. However, if I just put multiple multiline text elements after each other, they ignore each other's height (for both height caused by line wrapping and actual multiple lines of text). Since this is hard to explain without images, let me give an example:
All text elements contain text that has 2 lines. So you would expect to see element1 at line 1, element 2 at (roughly) line 4, and element 3 at line 7. However, with my settings, I get element 1 at line 1, element 2 at line 2, and element 3 at line 3, with the text overlapping each other.
Is this just a setting that I'm missing, or is this a fundamental issue with the GUI text element?
|Bilbo Beutlin (BBeutlin)||30.01.2020 22:48|
|So far I didn't play around with textElements, however found a note in the LUA, which might indicate a construction site:
line 596 -- TODO: apply engine vertical text alignment as soon as it's exposed to script
|Tim Derks (timmiej93)||31.01.2020 15:28|
|I don't think vertical alignment has anything to do with it, since vertical alignment works fine. After posting this yesterday, I had an idea how to solve this in code, which I implemented today. Simply said:
- get the text element's text height with TextElement:getTextHeight()
- set the element's size to its current with and the text height gathered in the point above with GuiElement:setSize()
|Bilbo Beutlin (BBeutlin)||31.01.2020 20:56|
|Should be merely a hint that the code is still 'under construction', changes or additions are to be expected.
And yes - in the way you briefly sketched, it should work.
Note: Log in to post. Create a new account here.