Screen rotation

PocketBuilder supports deployment to Windows Mobile 2003 Second Edition and Windows Mobile 5 devices and emulators. These platforms allow for screen rotation between portrait and landscape modes. They also support square screens and changes to screen resolution.

PocketBuilder lets you create multiple orientation views for windows, user objects, and DataWindow objects. You can use these orientations for creating layouts that change automatically when users switch screen orientation settings on their hand-held devices. For more information about MOP views in windows, see Chapter 10, “Working with Windows.”

Effects of screen rotation

PocketBuilder processes messages from WM 2003 SE or later operating systems when the screen orientation or resolution has changed. It automatically makes adjustments to all Main! type application windows to conform to the current Windows CE environment. The title bar on a main window also resizes automatically. Any open menus or notification bubbles are closed, and if the SIP is raised immediately before screen rotation, it is automatically lowered.

Response windows and message boxes are not changed when the screen orientation or resolution changes. When an application is running and the display orientation is changed, any response windows and message boxes are recentered on the display. There is special logic to make sure the response window’s title bar is still visible, since that is often the only way to close the window.

The Windows CE operating system sends a setting change message, PBM_Setting_Change, with a wParam value of 12290 when the user presses a button on the device (WM 2003 SE or later) to rotate the screen. The PocketBuilder pbm_settingchange event handler for this message resizes main windows to the new screen dimensions with required adjustments for any title and menu bars. If a MOP view exists for the new orientation, that MOP view is selected.

You can use MOP views or add code to the Resize event (or a pbm_settingchange user event) for a main window if you need to adjust the sizes or positions of controls on the window.

NoteObtaining the current screen size You must instantiate a new Environment object to obtain the current screen height and width. Environment objects that are instantiated prior to screen rotation or resolution changes will have incorrect or stale information.

Deployment using CAB files

If you build CAB files for deployment, the VersionMin value (in the CEDevice section of the application INF file) is set to 3.0. This defines the application for compatibility with Pocket PC 2002 devices and emulators, but also permits deployment to Windows Mobile devices and emulators.

PocketBuilder adds the BuildMax value of 0xE0000000 to the CEDevice section of the application INF file. This value prevents application users from seeing a warning message when installing the CAB file on older Pocket PCs, but allows developers to take advantage of features introduced for WM 2003 SE and WM 5 platforms.