Change screen orientation programmatically??

HARRY

Active Member
Licensed User
Longtime User
Hi,

I want to set at the start of my program the screen orientation to landscape and to portrait when closing the form.

Does somebody know about code to realize that?

Harry
 

PatrikL

Member
Licensed User
Hello, i have it on my desktop :)
 

Attachments

  • PPCorient.zip
    4.1 KB · Views: 820

Put Claude

Active Member
Licensed User
Longtime User
Hi,
I upload again the orientation programs, you have to use them with the
shell function:
If isppc = True Then Shell("Lndsc270.exe", "")

On the title you recognise where the pda-buttons are : BtnsR270.exe
means the buttons are on the right in this landscape mode.

You wil have automaticly scrollbars if the window do not fitt.
Did not think it was a handy thing to some people, enjoy it....

Put Claude Belgium
 

Attachments

  • PPCorient.zip
    8.1 KB · Views: 645

alfcen

Well-Known Member
Licensed User
Longtime User
Thanks a lot, Put

Thanks to you, I have successfully incorporated the orientation switchers in combination with dzt's HTML Viewer and formlib.dll (full screen) for the purpose of replaying Flash (.swf) files on maximum possible screen area.

Cheers
Robert
 

taximania

Well-Known Member
Licensed User
Longtime User
Hi,
I upload again the orientation programs, you have to use them with the
shell function:
If isppc = True Then Shell("Lndsc270.exe", "")

Put Claude Belgium

And, as usual for my device, the 'orientation programs' don't work. :sign0137:
I am programming on the device.

B4X:
Sub Globals
   'Declare the global variables here.

End Sub

Sub App_Start
   Form1.Show
End Sub


Sub Button1_Click
if isppc = true then Shell("Lndsc270.exe", "")

End Sub

If 'isppc' is invalid, you mean cPPC. Which still doesn't work on my device.
I will post more tomorrow after work.
I get the time to program the device at work :sign0060:
 

Put Claude

Active Member
Licensed User
Longtime User
hi taxmania,

Sorry if not understandable, this is a piece from the code, an I did not mentioning the variable 'isppc'...
Sub global

isppc=0

End Sub

Sub App_Start 'POINT to start

isppc = CPPC 'returns False or True=PPC, check if running on desktop or PPC
If isppc = True Then Shell("Lndsc270.exe", "")

work with variable, so I have not togo trough the cPPC function all the time...
Works with me on 4 different Pockets WM3 SE, WM 5, WM6 Pro....
Good luc....

Put Claude Belgium
 
Last edited:

SonicSue

Member
Licensed User
How do I detect change in screen orientation and have my form switch/adjust? I have an application that when the user slides out the keyboard and the screen rotates, the buttons do not rotate with the rest of the controls (labels and text boxes), and they (the buttons) cease to function. Thanks in advance. Please provide as much detail as possible because I am quite the newbie.
:sign0104:
 

agraham

Expert
Licensed User
Longtime User
If you are using WM5.0 or later then you could try using my http://www.b4x.com/forum/additional-libraries/3346-systemstate-library-wm-5-0-later.html to see if you can get a StateChanged event when the system DisplayRotation state changes. I've just noticed that there is a typo in the help :(. The second description titled GetState that returns a reference should be titled GetValue.

Also the Device object in my http://www.b4x.com/forum/additional-libraries/1995-controlsexdevice-library.html#post10811 lets you get and set the display rotation.
 

mjcoon

Well-Known Member
Licensed User
Also the Device object in my http://www.b4x.com/forum/additional-libraries/1995-controlsexdevice-library.html#post10811 lets you get and set the display rotation.

I think that Andrew meant the "Display" object (I can't find a Device object).

If you (anyone!) is using Basic4ppc - Windows Mobile programming and Pocket PC Development to get quick access to the documentation of library functions, note that it is well out of date. For instance the ControlsExDevice is shown there as having seven embedded objects whereas I count fifteen in version 1.8. The details are also correspondingly out of date too.

Mike.
 

corwin42

Expert
Licensed User
Longtime User
How do I detect change in screen orientation and have my form switch/adjust?
The easiest way to detect a screen rotation is the Resize event of the formlib.
See formlib helpfile for a small example.

There are several ways for adjusting the controls to screen resolution changes. I'm currently writing a small tutorial for adjusting applications for several screen resolutions. I hope to post it in a few days.

Greetings
 

SonicSue

Member
Licensed User
I will definitely be looking forward to your tutorial, since what I have is not working...:BangHead:
 

SonicSue

Member
Licensed User
Top