label.text length

Discuss GUI programming with the RapaGUI plugin here
Post Reply
ilbarbax
Posts: 117
Joined: Thu Apr 01, 2010 6:41 pm

label.text length

Post 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>
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: label.text length

Post 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.
Post Reply