Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips > Tutorials
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Tutorials Basic4ppc tutorials

Working with VGA screens

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-07-2008, 08:32 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default Working with VGA screens

Edit: Basic4ppc version 6.30 includes a new compilation target: Forced QVGA. In this method VGA screens will behave as regular QVGA screens, making it simpler to target both VGA and QVGA devices.

Windows Mobile devices come with two types of screens.
The regular QVGA screen: 240 * 320 (regular), 240 * 240 (square screen) or 320 * 240 (landscape).
High resolution screens - VGA: 480 * 640 (regular), 480 * 480 (square screen) or 640 * 480 (landscape).

VGA devices use a special mechanism to properly show applications which were not designed for VGA screens. It is called pixel doubling.
Each pixel is doubled and the result is a pseudo lower resolution screen (QVGA).

Non-optimized compiled applications use pixel doubling. Therefore your application will show exactly the same on VGA and QVGA screens.

Optimized compiled applications do not use this method (.Net CF 2.0 restriction).
This allows you to take advantage of the higher resolution screen.
However if you don't explicitly handle VGA screens, your application will not show properly on such devices.

The following code automatically changes the layout of all controls to match the VGA screen:
Code:
Sub Globals
    
Dim Controls(0)
End Sub

Sub App_Start
    
If form1.Height > 400 Then ChangeToVGA
    Form1.Show
End Sub

Sub ChangeToVGA
    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 = 
2 * Control(Controls(i)).Left
                Control(Controls(i)).Top = 
2 * Control(Controls(i)).Top
                Control(Controls(i)).Height = 
2 * Control(Controls(i)).Height
                Control(Controls(i)).Width = 
2 * 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
'Controls' is an array that later holds all controls.
Somewhere in the beginning of the program you should check one of the forms height (doesn't matter which form), and call ChangeToVGA if necessary.
ChangeToVGA should only be called once and it will handle all the controls on all forms.

* Calendars controls do not show properly on VGA screens (with the optimized compiler). It will be fixed in the future.
* The image in ImageButtons and Images controls not in cStretchImage mode will be smaller on VGA screens. You should use two sets of images in that case.
Reply With Quote
  #2 (permalink)  
Old 02-12-2008, 12:22 PM
Basic4ppc Veteran
 
Join Date: Feb 2008
Posts: 200
Default

Seems to me each "Panel" contaning other controls should be called, too.

Edit:
Oh, Control(Controls(i)).
Reply With Quote
  #3 (permalink)  
Old 02-13-2008, 07:24 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

GetControls("") returns all the controls on all forms. Unlike GetConfrols("Form1") which will return only Form1 direct sons.
Reply With Quote
  #4 (permalink)  
Old 02-13-2008, 07:28 AM
Basic4ppc Veteran
 
Join Date: Feb 2008
Posts: 200
Default

Yes, thanks, all works fine.
Reply With Quote
  #5 (permalink)  
Old 02-22-2008, 08:45 AM
Senior Member
 
Join Date: Dec 2007
Posts: 149
Awards Showcase
Beta Tester Beta Tester 
Total Awards: 2
Default What's about the Treeview icons?

Hello Erel,
with controls that are dirrectly placed in the Form your workaround works well, but the first time I had problems with it where the controls on a panel.
I scaled that controls separatly and it computes well. But now I have a VGA-problem with the Treeview-icons. How should I scale them?
On the way: working with VGA in B4P is very hard, because the appereance is three times different: The desktop is another as the device and both are different as the compiled version, particulary if you should work with Fullscreen2(False,True), which will not work if you run the source in the device editor.
Isn't it possible to have a real VGA-compatible device-editor

Best regards

berndgoedecke
Reply With Quote
  #6 (permalink)  
Old 02-22-2008, 11:38 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You can add this code to handle the TreeView control:
Code:
Case "TreeView.TreeView":
                Control(Controls(i),TreeView).Left = 
2 * Control(Controls(i),TreeView).Left
                Control(Controls(i),TreeView).Top = 
2 * Control(Controls(i),TreeView).Top
                Control(Controls(i),TreeView).Height = 
2 * Control(Controls(i),TreeView).Height
                Control(Controls(i),TreeView).Width = 
2 * Control(Controls(i),TreeView).Width
                Control(Controls(i),TreeView).ImageSize(
50,50)
You should initialize the treeviews (with New1) before calling the ChangeToVGA sub.
Load images and assign them only after calling this sub.

A VGA device IDE will be available in the future.
Reply With Quote
  #7 (permalink)  
Old 02-22-2008, 12:40 PM
Senior Member
 
Join Date: Dec 2007
Posts: 149
Awards Showcase
Beta Tester Beta Tester 
Total Awards: 2
Default Thanks for TreeView-scaling

Hello Erel,
Much hanks for TreeView-scaling and the hint of an in future avaliable VGA-IDE.
I do it await in the hope to have an easier job.

Best Regards

berndgoedecke
Reply With Quote
  #8 (permalink)  
Old 02-23-2008, 01:19 PM
Knows the basics
 
Join Date: May 2007
Posts: 64
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi,

I am trying to adapt my TRPPC applet to make it automatically compatible with QVGA/VGA and Portrait/Landscape screens.
I have come upon a strange problem (maybe I am stupid). I am trying to set the height of a table in a panel in a way to occupy the totality of the residual height after having accounted the space for other controls and the margins I want around them. But this automatically computed height gets bigger that the real residual space if the table needs scroll bars. So I understand that the size of these bars are not included in the .Height property of a Table. Am I wright?
In order to solve the problem, I subtract some supplementary height when I set the height of the table (52 pixels in VGA). I have a menu in my application.

Is there a better way to automatically set the height of the table?

Regards,

Murat
__________________
PC: Laptop CoreDUo, Windows XP SP2 French
PPC: TyTN, WM5 French -> iPAQ 214 WM6 French (to diverge or not to diverge,...)

Last edited by yildi : 02-23-2008 at 01:21 PM.
Reply With Quote
  #9 (permalink)  
Old 02-23-2008, 05:07 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I'm not sure that I correctly understood your problem.
I suggest that you start a new thread and post a small code that demonstrates it if possible.
Reply With Quote
  #10 (permalink)  
Old 02-23-2008, 05:36 PM
Knows the basics
 
Join Date: May 2007
Posts: 64
Awards Showcase
Beta Tester 
Total Awards: 1
Default

OK. I will do it when I have sometime to simplify my code.
__________________
PC: Laptop CoreDUo, Windows XP SP2 French
PPC: TyTN, WM5 French -> iPAQ 214 WM6 French (to diverge or not to diverge,...)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiled EXE is not working on HP iPAQ214 mozaharul Questions (Windows Mobile) 25 10-14-2008 11:18 AM
Forelayer not working(?) Cableguy Questions (Windows Mobile) 5 08-16-2008 12:52 PM
working with date gjoisa Questions (Windows Mobile) 3 03-29-2008 10:40 AM
working with FormExDesktop_1.2 Cableguy Questions (Windows Mobile) 20 01-28-2008 07:02 PM
calling the device's "Programs" or "settings" screens HarleyM Questions (Windows Mobile) 0 12-05-2007 03:59 AM


All times are GMT. The time now is 09:11 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0