adjusting label width according to text

tufanv

Expert
Licensed User
Longtime User
Hello,

I found out that via string utils i can mesaue the height but is there any way to set the label's width according to text's length ( for example if label is hello the width will be shorter but if its hello world than it will be longer )

TY
 

mangojack

Expert
Licensed User
Longtime User
tufanv .. this might be of interest ...
Measure String Width

once you have the string width value then you can apply to Label.width

Cheers mj
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
I made a try now and the problem is :

I have 4 labels side to side. In my designers script when i change the widths of all labels to -2 , i cant place them side by side easily because the left values of all labels are calculated by previouslabel.width + previouslabel.left. Am I doing stg wrong or do i need to change all the code for this new widths ? or a better question . is there a better way to put multiple objects side by side more easier ? :sign0104:

TY
 
Upvote 0
Top