Bill Kantz Member Licensed User Longtime User Mar 14, 2015 #1 I have a designer script to horizontalaly center a label. this script works B4X: AutoScaleAll Label1.SetLeftAndRight(0,100%X) Label1.SetTopAndBottom(2%Y,27%Y) Label1.TextSize = 60 this one does not. B4X: AutoScaleAll Label1.HorizontalCenter = 50%x Label1.width = 100%x Label1.SetTopAndBottom(2%Y,27%Y) Label1.TextSize = 60 I assume HorizonalCenter doesn't work the way I think it does? Bill
I have a designer script to horizontalaly center a label. this script works B4X: AutoScaleAll Label1.SetLeftAndRight(0,100%X) Label1.SetTopAndBottom(2%Y,27%Y) Label1.TextSize = 60 this one does not. B4X: AutoScaleAll Label1.HorizontalCenter = 50%x Label1.width = 100%x Label1.SetTopAndBottom(2%Y,27%Y) Label1.TextSize = 60 I assume HorizonalCenter doesn't work the way I think it does? Bill
stevel05 Expert Licensed User Longtime User Mar 14, 2015 #2 Try setting the width before setting the horizontal center so it can calculate where the center should be. Upvote 0
Try setting the width before setting the horizontal center so it can calculate where the center should be.
RandomCoder Well-Known Member Licensed User Longtime User Mar 14, 2015 #3 HorizontalCenter returns the position of the parent view at which the center point is located. Upvote 0
Peter Simpson Expert Licensed User Longtime User Mar 15, 2015 #4 Label1.HorizontalCenter = 50%x works perfectly fine, I use it all the time. Do you really need your label to be 100% wide? Anyway just swap the first 2 Label1 lines around. Upvote 0
Label1.HorizontalCenter = 50%x works perfectly fine, I use it all the time. Do you really need your label to be 100% wide? Anyway just swap the first 2 Label1 lines around.