Scotter Active Member Licensed User Dec 29, 2018 #1 Hi - In the designer I've set the padding, horiz align to "center_horizontal", and vert align to "center_vertical". And in my activity_create: B4X: '......................padding: left, top, right, bottom lblCard1.Padding = Array As Int(10dip,10dip,10dip,10dip) lblCard1.Gravity=Gravity.CENTER_HORIZONTAL lblCard1.Gravity=Gravity.CENTER_VERTICAL lblCard1.TextSize=34 But I get left justified when I run the program. Ideas?
Hi - In the designer I've set the padding, horiz align to "center_horizontal", and vert align to "center_vertical". And in my activity_create: B4X: '......................padding: left, top, right, bottom lblCard1.Padding = Array As Int(10dip,10dip,10dip,10dip) lblCard1.Gravity=Gravity.CENTER_HORIZONTAL lblCard1.Gravity=Gravity.CENTER_VERTICAL lblCard1.TextSize=34 But I get left justified when I run the program. Ideas?
Scotter Active Member Licensed User Dec 29, 2018 #2 Is this a bug in 8.50 or am I missing something? Upvote 0
mangojack Expert Licensed User Longtime User Dec 30, 2018 #3 If you are setting these properties in Designer ... there is no need to call them again in code. Removing the lines from Activity_Create solves the problem .. although I can't explain why the problem is created by these lines. Maybe someone can explain / expand on this later. Upvote 0
If you are setting these properties in Designer ... there is no need to call them again in code. Removing the lines from Activity_Create solves the problem .. although I can't explain why the problem is created by these lines. Maybe someone can explain / expand on this later.
Scotter Active Member Licensed User Dec 30, 2018 #4 mangojack said: If you are setting these properties in Designer ... there is no need to call them again in code. Removing the lines from Activity_Create solves the problem .. although I can't explain why the problem is created by these lines. Maybe someone can explain / expand on this later. Click to expand... OMG that worked! Upvote 0
mangojack said: If you are setting these properties in Designer ... there is no need to call them again in code. Removing the lines from Activity_Create solves the problem .. although I can't explain why the problem is created by these lines. Maybe someone can explain / expand on this later. Click to expand... OMG that worked!
Scotter Active Member Licensed User Dec 30, 2018 #5 @Erel can you please look at this thread? I'm wondering if this is a bug in 8.50? Thanks! Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 30, 2018 #6 Best solution is to use B4XView B4X: Dim lblCard1 As B4XView 'in Globals lblCard1.SetTextAlignment("CENTER", "CENTER") Or: B4X: lblCard1.Gravity = Bit.Or(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_VERTICAL) Setting the gravity twice overwrites the previous value. Upvote 0
Best solution is to use B4XView B4X: Dim lblCard1 As B4XView 'in Globals lblCard1.SetTextAlignment("CENTER", "CENTER") Or: B4X: lblCard1.Gravity = Bit.Or(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_VERTICAL) Setting the gravity twice overwrites the previous value.
klaus Expert Licensed User Longtime User Dec 30, 2018 #7 Or: B4X: lblCard1.Gravity = Gravity.CENTER Upvote 0
Didier9 Well-Known Member Licensed User Longtime User Dec 31, 2018 #8 Thank you, I had come across this unexpected behavior. Now I know how to deal with it! Upvote 0