Hersir Difference on second show is that it gets correct text immediately as text is already loaded so it gets correct size, on first attempt it have temp text thats much longer then one thats loaded from file and changes it after text is loaded (text property update)
Okay, so it means that this is the expected behavior. Because you are using JUSTIFY, the width of the buttons is set explicitly, and they won't resize when the text changes.
If you would like them to resize when they receive new text, it can probably be done somewhat manually.
First, set justifyResetEnabled to true on the VerticalLayout. That should ensure that the buttons are given the chance to measure themselves again. Basically, it resets the explicit width set by JUSTIFY every time that the layout code is run.
Then, you need to force the LayoutGroup to run its layout code again. There are many ways to do that.
- You might set layouttonull, and then back to theVerticalLayout.
- You could dispatch Event.CHANGEfrom theVerticalLayout
- You could call setInvalid(LAYOUT)on theLayoutGroup.
I'm sure there are more options. Since you're using Coconut, it might be a little trickier than with pure Haxe, so I gave you a few options.