The ScreenOrientation Module is used to control the screen orientation / layout and register to receive an event when it changes. ## Enabling the API In order to use this API you must include the following extension in your `build.yml`. :::ruby extensions: ["screenorientation"] ## JavaScript Usage Be sure to review the [JavaScript API Usage](/guide/api_js) guide for important information about using this API in JavaScript. ## Ruby Usage Be sure to review the [Ruby API Usage](/guide/api_ruby) guide for important information about using this API in Ruby. ## Persistence With the old PocketBrowser / RhoElements 1 APIs, any events, such as `screenOrientationEvent` were canceled when a full navigate was performed. The original reason for this was a limitation of the IE engine on WM5 devices. When moving to the common API this was changed so that callbacks are not canceled. Properties used to configure Screen Orientation module. Enables or Disables auto-rotation of the screen orientation when the device is rotated. For Windows Mobile/CE devices, support is limited to only Symbol Technologies devices with IST Sensor support. iOS, Android, WM Sets the screen orientation to default device orientation. Android, WM Sets the screen orientation to right-handed orientation. Note the webpage will not reformat in line with the new screen size automatically. Android, WM Sets the screen orientation to left-handed orientation. Note the webpage will not reformat in line with the new screen size automatically. Android, WM Sets the screen orientation to upside down, useful if presenting the device to a customer to obtain a signature. Android, WM Sets the callback to be called when a screen orientation event occurs. iOS, Android, WM Current orientation of the screen. The orientation is reported as normal, leftHanded, rightHanded or upsideDown. If auto rotation is disabled in the device - real rotating of device do not produce an event. The event occurs only for real changing of screen orientation, also "upsideDown" Method shall behave like "normal" Method. 4.0.0 WM, CE, Win32, Android, iOS, WP8
Detect when the device changes orientation. :orientation_callback)) end def orientation_callback Alert.show_popup("The screen changed orientation") end ]]>
Set the screen orientation programmatically. Particularly useful in a tablet: before capturing a signature, set the orientation to upside-down so that the interface will look right from the signer's point of view without having to physically rotate the device. :signature_callback)) end def signature_callback # do whatever we need to do with the signature ... # restore screen orientation to default Rho::ScreenOrientation.normal end ]]>
Enable / disable automatic rotation of the screen according to device orientation.