ScreenOrientation Module

RhoElements 2.x API

Overview

The ScreenOrientation Module controls the screen orientation and layout, and can register to receive an event when it changes.

Syntax

screenOrientation (Module) <META> Syntax

<META HTTP-Equiv="ScreenOrientation" content="[orientation]">

<META HTTP-Equiv="ScreenOrientation" content="ScreenOrientationEvent:url('[jsFunction | url]')">

ScreenOrientation JavaScript Object Syntax:
By default the JavaScript Object 'screenOrientation' will exist on the current page and can be used to interact directly with the screenOrientation.
To Invoke screenOrientation methods via JavaScript use the following syntax: screenorientation.method();

e.g. screenOrientation.normal();

To Set screenOrientation parameters via JavaScript use the following syntax: screenorientation.parameter = 'value'; remembering to enclose your value in quotes where appropriate.

e.g. screenOrientation.autoRotate = 'value';

To Set screenOrientation return events via JavaScript use the following syntax: screenorientation.event = JavaScript Function;

e.g. screenOrientation.screenOrientationEvent = 'doFunction(%json)';

To set multiple EMML parameters / events on a single line use the following syntax: screenorientation.setEMML("[Your EMML Tags]");

e.g. screenOrientation.setEMML("autoRotate:value;screenOrientationEvent:url('JavaScript:doFunction(%json)');normal");

Methods

Items listed in this section indicate methods or, in some cases, indicate parameters which will be retrieved.

NameDescriptionDefault Value
normalSets the screen orientation to portraitDevice Dependant
rightHandedSets the screen orientation to righthanded (landscape). Note the webpage will not reformat in line with the new screen size automatically.Device Dependant
leftHandedSets the screen orientation to lefthanded (landscape). Note the webpage will not reformat in line with the new screen size automatically.Device Dependant
upsideDownSets the screen orientation to upside down, useful if presenting the device to a customer to obtain a signature.Device Dependant

Parameters

Items listed in this section indicate parameters, or attributes which can be set.

NamePossible ValuesDescriptionDefault Value
autoRotate:[Value] 'Enabled' or 'Disabled'Enables or Disables autorotation of the screen orientation when the device is rotatedDefined in Configuration File

Events

Values are returned to the caller in RhoElements via Events. Most modules contain events and those returned from this module are given below along with the event parameters. Events can cause a navigation to a new URL or a JavaScript function on the page to be invoked. Each event will in most cases have a number of parameters associated with it which will either be strings or JavaScript arrays. Event parameters can be accessed either directly or via JSON objects.


screenOrientationEvent

The screen orientation event is sent when the current RhoElements application changes the orientation of the screen. For devices with an inbuilt accelerometer this event will also be sent when the user physically rotates the device to a new orientation.

IDNameDescription
1orientationEither 'normal', 'rightHanded', 'leftHanded' or 'upsideDown'

Multi Instance

When multiple RhoElememts applications are running the following considerations should be made: The screen orientation settings are application specific. Switching to another application which uses the ScreenOrientation module will cause the screen to be rotated automatically if necessary

Remarks

Effect on Command Areas and Control Buttons

When the screen orientation changes, either using the ScreenOrientation tag or by rotating a device with hardware support, the command areas will automatically move and resize to fit the new layout. However the buttons themselves are not moved and in some cases this may result in them being off the screen or not in the expected position. If so they must be moved manually by detecting the ScreenOrientationEvent.

Orientation Persistence

In all devices apart from the Enterprise Tablet, orientation changes will persist if RhoElements is closed or the device is warm booted.

Landscape Windows Devices

By default the Screen Orientation module will assume the "Normal" orientation of your device is portrait mode. Devices which default to landscape mode (e.g. VC model devices) may need to be set to "leftHanded" in order to achieve an 'out of the box' orientation.

Requirements

RhoElements Version1.0.0 or above
Supported DevicesAll supported devices. autoRotate is only supported in devices that have IST.
Minimum RequirementsA device with a screen.
PersistencePartially Persistent - Changes to this module will persist when navigating to a new page with the exception of ScreenOrientationEvent

HTML/JavaScript Examples

The following example orients the screen to "right-handed" in landscape mode:

<META HTTP-Equiv="ScreenOrientation" Content="RightHanded">