How to adapt a form size to HTC Touch HD 480x800

2220

Member
Licensed User
Hello,

I've sent my app to a customer and he have just bougth a HTC Touch HD.
He doesn't see anything.

How can I adapt the app to this resolution (480*800)?

Must I resize all the app to this screen size?
I though the app will take a 640x480 screen resolution, but no.

Best regards.
 

2220

Member
Licensed User
I must rescale the controls , positions and make images bigger.

How can I know the resolution screen?
 

Cableguy

Expert
Licensed User
Longtime User
You can check both form.width and formHeight and re-scale to a factor...

Ie:
Base scale for form width =240 (qvga)

for a vga screen the scale would be the form.width/240, lets say 3.5...

Then you wwould aply this to make the controls look the same regardless...

Controlname.width=int(controlname width*3.5)

For the posicion of the controls, I suggest to use a "virtual" grid, and rescale it acording to the screen size...

Font size will be a mater or hard coding and experimenting...

I hope to have helped...
 
Last edited:

N1c0_ds

Active Member
Licensed User
B4X:
If Form.Width/Form.Height=3/4 Then...
If it's bigger, it's not a normal portrait screen (QVGA,VGA)

Now if your application also works in landscape:

You could try something like that (please note the top and bottom bars are not counted when getting Form.Height. Thus a 320 pixels screen height will return 268. Each bar is 26 pixels high on QVGA screens or 52 pixels high on VGA screens.)

B4X:
If Form.Width>Form.Height Then
 If Form.Width/Form.Height=240/268 Then
  [I]ScreenFormat=VGA or QVGA (portrait)[/I]
 End If
Else If Form.Width<Form.Height Then
 If Form.Width/Form.Height=320/188 Then
  [I]ScreenFormat=VGA or QVGA (landscape)[/I]
 End If
Else If Form.Width/Form.Height=240/188 Then
  [I]Screenformat="Square screen"[/I]
Else
  [I]Screenformat="Other"[/I]
End If


Once you discover the size of the form, you can use Form.Height and Form.Width to align controls.
B4X:
Control.Top=Form.Height-Control.Height
will align your control to the bottom of the screen, for example.
 
Last edited:
Top