Non-standard Screens

dlfallen

Active Member
Licensed User
I'm considering the purchase of a smartphone running Windows Mobile 6, with the intent to use Basic4PPC to program for it. Neither of the two candidates have a standard (VGA or QVGA) screen size. One is 320 x 320, and the other is 240 x 400. This leads to 3 questions:

(1) Is the non-standard screen size going to complicate writing the programs?

(2) Will programs written for the QVGA look funny on the non-standard screen?

(3) Will programs I write for the non-standard screens look funny on standard QVGA and VGA screens?

These smartphones (Samsung Saga and Samsung Omni) are pricy so I'd like to resolve these issue before purchase. Thanks for any informaion you may have!
 

klaus

Expert
Licensed User
Till now I have only written programs for QVGA screens and added Fillipo's routine 'ChangeToVGA' to support VGA screens.

Answers to your questions:

1) The programing becomes a little bit more complicated because of the handling of the different screen sizes. From QVGA to VGA it's easy because the width-height ratio is the same and there is just the scale factor of 2. In that case all the Top, Left, Width and Height values are multiplied by the scale factor.

2) The change for screens with different width-height ratios it becomes more complicated.
For example:
-From 240/320 to 240/400 the lower part of the screen will be blank, or you should multiply all Height parameters of the controls by 400/320=1.25 to change their spacing.
-From 240/320 to 320/320 you could stretch the screen horizontally by multiplying all the Left and Width paramters of the controls by 320/240=1.33 otherwise the right third of the screen will be blank.

3) The same reasoning applyes here.
- From 320/320 to 240/320 you will miss the right third of the screen or you must shrink the screen width by 240/320=0.67 (same principle as stretching) with the risk that some controls are too small or you must foresee the control sizes to fit into a 240 pixel width.
- From 240/400 to 240/320 you will miss the lower 80 pixels or shrink the screen vertically.

Or you have a different source code for each screen size, which is also not that convenient.

Best regards.
 

digitaldon37

Active Member
Licensed User
Till now I have only written programs for QVGA screens and added Fillipo's routine 'ChangeToVGA' to support VGA screens.

Answers to your questions:

1) The programing becomes a little bit more complicated because of the handling of the different screen sizes. From QVGA to VGA it's easy because the width-height ratio is the same and there is just the scale factor of 2. In that case all the Top, Left, Width and Height values are multiplied by the scale factor.

2) The change for screens with different width-height ratios it becomes more complicated.
For example:
-From 240/320 to 240/400 the lower part of the screen will be blank, or you should multiply all Height parameters of the controls by 400/320=1.25 to change their spacing.
-From 240/320 to 320/320 you could stretch the screen horizontally by multiplying all the Left and Width paramters of the controls by 320/240=1.33 otherwise the right third of the screen will be blank.

3) The same reasoning applyes here.
- From 320/320 to 240/320 you will miss the right third of the screen or you must shrink the screen width by 240/320=0.67 (same principle as stretching) with the risk that some controls are too small or you must foresee the control sizes to fit into a 240 pixel width.
- From 240/400 to 240/320 you will miss the lower 80 pixels or shrink the screen vertically.

Or you have a different source code for each screen size, which is also not that convenient.

Best regards.
I have a modified version of Filippos changetovga routine that works for all screen sizes (at least in the emulators).
B4X:
Sub SetDisplay
' Msgbox("width: " & form1.Width & CRLF & "height: " & form1.Height)

Select form1.Width
      Case 240
         ScaleW=1
      Case 320
         ScaleW=1.5
      Case 480
         ScaleW=2
   End Select
   
   Select  form1.Height+52
      Case 320
         ScaleH=1
      Case 400
         ScaleH=1.5
      Case 640
         ScaleH=2
      Case 800
         ScaleH=2.5
   End Select



    Controls() = GetControls("")
    For i = 0 To ArrayLen(Controls())-1
        Select ControlType(Controls(i))
            Case "ListBox","NumUpDown","Button","TextBox","Label","ComboBox","Panel","RadioBtn","Table","ImageButton","CheckBox","Image"
               Control(Controls(i)).Left = scaleW * Control(Controls(i)).Left
               Control(Controls(i)).Top = scaleH * Control(Controls(i)).Top
                Control(Controls(i)).Height = scaleH * Control(Controls(i)).Height
                Control(Controls(i)).Width = scaleW * Control(Controls(i)).Width
'*** Uncomment these lines if your application includes Tables.
'                If ControlType(Controls(i)) = "Table" Then
'                    tbl = Controls(i)
'                    For i2 = 0 To Control(tbl,Table).ColCount-1
'                        col = Control(tbl,Table).ColName(i2)
'                        Control(tbl,Table).ColWidth(col) = Control(tbl,Table).ColWidth(col) * 2
'                    Next
'                End If
        End Select
    Next
End Sub
 

N1c0_ds

Active Member
Licensed User
It's entirely possible! Gecko can support any bastard resolution you throw at it by using undefined positions. Controls are moved and stretched to accomodate any screen size.

Instead of hello.top=230, put in hello.top=form.height-10 so a bottom bar fits on all screens, for example.

I wrote a tutorial for a much more reliable VGA conversion method.
 
Top