Designer Script Problem

JTmartins

Active Member
Licensed User
Longtime User
Hi, good people.

I'm always having problems with designer scripts.

Why does this gives me the middle button much bigger (height) than the other 2, and when we change resolutions, they only get centered in 800x480 (testing in emulator with several different setups). Width however is OK.

In 960 x 600 and 1280 x 800 they are not centered in the screen

Buttons are placed in a activity. Nothing else there.

Using autoscale all does not change anything in this situation.

By the way, sending this to the UI cloud, appears correct only in Samsung I9000 (4" phone) and Samsung Pocket (2.8" phone)...It does not help much, as I expect the app to be run in tabblets, not phones.



B4X:
texto1=22

BtnAulas.TextSize=texto1
BtnAulas.HorizontalCenter=50%x
BtnAulas.Top=20dip
BtnAulas.Width=350dip
BtnAulas.Height=60dip

BtnAlunos.TextSize=texto1
BtnAlunos.HorizontalCenter=50%x
BtnAlunos.Top=BtnAulas.Bottom+20dip
BtnAlunos.Width=350dip
BtnAulas.Height=60dip

BtnMensagens.TextSize=texto1
BtnMensagens.HorizontalCenter=50%x
BtnMensagens.Top=BtnAlunos.Bottom+20dip
BtnMensagens.Width=350dip
BtnMensagens.Height=60dip

I always get frustrated with the designer...what am I doing wrong ?

Thanks

José
 
Last edited:

klaus

Expert
Licensed User
Longtime User
Use this code :
B4X:
BtnAulas.TextSize=texto1
BtnAulas.Top=20dip
BtnAulas.HorizontalCenter=50%x
You must put BtnAulas.HorizontalCenter after BtnAulas.Width !
Because if you center the button you set the Left property according to the middle of the screen and the Width property.
Then you change the Width property but the Left property remains the same so it's no more centered.
You don't need to set BtnAulas.Width=350dip and BtnAulas.Height=60dip set their values directly to 350 and 60 in the Designer. These values are dip values in the Designer.

Best regards.
 
Upvote 0

JTmartins

Active Member
Licensed User
Longtime User
That's it

Thank you Klaus,

You saved my day. Works Like a charm.

I think now I understand a little better the reasons of my problems with designer.

Thanks again Erel & Klaus.
 
Upvote 0
Top