Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

Controlling orientation changes


Controlling orientation changes

Postby j.edwards » Apr 8, 2008 @ 4:59am

Is it possible with PocketHAL to not automatically have the screen and keys rotated when orientation is changed by sliding out the keyboard? I need to be able to accept the orientation change on some screens, but force it to remain portrait on other screens that haven't been designed to cope with landscape orientation.
User avatar
j.edwards
pm Member
 
Posts: 240
Joined: Oct 29, 2003 @ 11:09am
Location: Australia


Postby Kzinti » Apr 8, 2008 @ 6:00am

If I understand correctly, you do not want PocketHAL to "rotate" directional keys and mouse positions when the display orientation changes?

The problem is how does one detect that a screen hasn't been designed to cope with landscape orientation... The functionality could easily be added and activated with a flag at initialization time, but I wouldn't know how to detect that a phone has a sliding keyboard...
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby j.edwards » Apr 8, 2008 @ 6:36am

The control needs to be defined in application logic, so the application must let PocketHAL know whether it is acceptable to change the orientation and remap keys.

Don't worry about the sliding keyboard - just assume any orientation change as reported through WM_SETTINGCHANGE. In fact, probably don't even need to worry about that - just if device reports back different orientation different to last frame then there needs to be a way for the application to say whether it should allow PocketHAL to auto adjust according to the change as well.

The issue I'm trying to work around is that some screens in the application are designed for only landscape and don't make sense changing orientation even if the user slides the keyboard out - just want to keep it in portrait as if nothing happened.

At the moment I have my code responding to a WM_SETTINGCHANGE message to check if the shell orientation has changed, and if so I recreate the Display object with the currently reported orientation. I can't remember why I do that - it might have been for pre-1.03 when keys weren't auto remapped? Is there actually a need to recreate the Display object on orientation change? Perhaps if I didn't do that it would just carry on as per normal anyhow?

Does that sound right? Could I just ignore WM_SETTINGCHANGE and not recreate the Display for when I want orientation preserved, but leave current functionality for when I want auto orientation awareness? In which case PHAL doesn't need any change, just the way I'm working with it.
User avatar
j.edwards
pm Member
 
Posts: 240
Joined: Oct 29, 2003 @ 11:09am
Location: Australia


Postby Kzinti » Apr 8, 2008 @ 6:51am

Yes, I think that would work for you.

And yes, you did it that way because PocketHAL didn't support auto-rotation of keys / stylus before.

Although all this makes me feel that rotation shouldn't be in PocketHAL. Perhaps I could move it out to the samples framework.
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby j.edwards » Apr 8, 2008 @ 7:00am

Ok, just done a test and it works. By not recreating the display object it stays in the correct orientation, keys are fine, everything is ok.

I'm happy with key mapping being where it is. What I'm going to do with the WM_SETTINGSCHANGE handler is rather than immediately create a Display object I will pass it back to my Application class to request if the orientation change should be allowed. If it is allowed then as per existing code, if not, skip the call to create new display.

Only tested this on one device but am assuming this should be consistent.

Thanks Thierry.
User avatar
j.edwards
pm Member
 
Posts: 240
Joined: Oct 29, 2003 @ 11:09am
Location: Australia


Postby hrissan » May 12, 2008 @ 7:44am

This approach definetely works! We use it in our iwindowsmobile.com software. :)
hrissan
pm Member
 
Posts: 30
Joined: Mar 10, 2007 @ 1:38pm


Return to PocketFrog & PocketHAL


Sort


Forum Description

SDKs for fast and robust device-independent access to Pocket PC display hardware.

Moderators:

sponge, Kzinti

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron