Tip of the Month (October 2009) Handling Screen Rotation A Visual CE form is laid out assuming that the handheld display is in portrait mode (taller than it is wide) or landscape mode (wider than it is tall). On many devices, it is possible to switch from one mode to the other while a form is open. And, of course, you want your form to adapt to the change. There is no way to build a single form that works in both modes and still makes use of all the available screen space. Visual CE will not automatically move and resize your controls around to fit a changed screen orientation. You can, however, build two forms over the same table and, when the screen rotates, switch from one form to the other.
So the first thing you should do is create two forms. Call one PORTRAIT.VCE and the other LANDSCAPE.VCE. The easiest way to do this is create PORTRAIT.VCE first. Then copy the .VCE file and rename the copy to LANDSCAPE.VCE. Then open LANDSCAPE.VCE and just move the controls around. The next thing you should do is put in the macros to deal with the screen rotations in PORTRAIT.VCE:
Then, do a similar thing in LANDSCAPE.VCE:
When the form runs, it will first check the orientation of the screen. If the wrong form is running, it will launch the right one. And, while the form is open, if the screen rotates, the other form will be launched. Previous Tips of the Month |