tufanv Expert Licensed User Longtime User Jul 9, 2013 #1 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
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 Jul 9, 2013 #2 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 .. this might be of interest ... Measure String Width once you have the string width value then you can apply to Label.width Cheers mj
Erel B4X founder Staff member Licensed User Longtime User Jul 9, 2013 #3 You can set the width to -2. This is a special constant that sets the width to match the text. Upvote 0
tufanv Expert Licensed User Longtime User Jul 9, 2013 #4 Oh Great Erel. ! Thanks for the responses ! Upvote 0
tufanv Expert Licensed User Longtime User Jul 9, 2013 #5 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
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
Erel B4X founder Staff member Licensed User Longtime User Jul 9, 2013 #6 It will be difficult to use -2 with multiple labels that need to be located one after another. Why not use a single label with the text of all the labels? The result will be the same. Upvote 0
It will be difficult to use -2 with multiple labels that need to be located one after another. Why not use a single label with the text of all the labels? The result will be the same.
tufanv Expert Licensed User Longtime User Jul 9, 2013 #7 There are little pictures between all of the labels . Thats the problem i think Upvote 0
M Mahares Expert Licensed User Longtime User Jul 9, 2013 #8 Erel's autotextsizelabel class: http://www.b4x.com/forum/additional...custom-view-autotextsizelabel.html#post177986 adjusts the text size to fit the label width. It may be an alternative to look at. Upvote 0
Erel's autotextsizelabel class: http://www.b4x.com/forum/additional...custom-view-autotextsizelabel.html#post177986 adjusts the text size to fit the label width. It may be an alternative to look at.