Page 1 of 1

label.text length

Posted: Wed Sep 30, 2020 3:44 pm
by ilbarbax
I noticed that the length of the label is set when the form is built in relation to the length of the text on the label itself.

It set a new text in the hws with the set instruction the length is not updated, at lest the form layout remain the same.

Then in case I set like that

Code: Select all

<label id="kjkj" Align="Center" > </label> 
in reality it set the length to zero and the label is not visible

changing it later with

Code: Select all

 moai.Set("kjkj","text","label comment")
the new text is still invisible because the length remains set to zero.

Trick is to set a fake label in the the xml file with an appropriate length like

Code: Select all

 <label id="kjkj" Align="Center" >aaaaaaaaaaaaaa</label>

Re: label.text length

Posted: Wed Sep 30, 2020 7:44 pm
by airsoftsoftwair
That's defined behaviour. RapaGUI will never do a re-layout when setting attributes. You can force a re-layout by calling Group.InitChange, then remove the label widget using Group.Remove, set the new text, and then add the widget again using Group.Insert, then call Group.ExitChange.