The ScreenOrientation Module is used to control the screen orientation/layout and register to receive an event when it changes.
In order to use this API you must include the following extension in your build.yml
extensions: ["screenorientation"]
Be sure to review the JavaScript API Usage guide for important information about using this API in JavaScript
Be sure to review the Ruby API Usage guide for important information about using this API in Ruby
Sets the screen orientation to lefthanded orientation. Note the webpage will not reformat in line with the new screen size automatically.
Synchronous Return:
Method Access:
Rho.ScreenOrientation.leftHanded()
Rho::ScreenOrientation.leftHanded()
Sets the screen orientation to default device orientation
Synchronous Return:
Method Access:
Rho.ScreenOrientation.normal()
Rho::ScreenOrientation.normal()
Sets the screen orientation to righthanded orientation. Note the webpage will not reformat in line with the new screen size automatically.
Synchronous Return:
Method Access:
Rho.ScreenOrientation.rightHanded()
Rho::ScreenOrientation.rightHanded()
Sets the callback to be called when a screen orientation event occurres
Parameters
Async Callback Returning Parameters: STRING
Synchronous Return:
Method Access:
Rho.ScreenOrientation.setScreenOrientationEvent(CallBackHandler callback)
Rho::ScreenOrientation.setScreenOrientationEvent(CallBackHandler callback)
Sets the screen orientation to upside down, useful if presenting the device to a customer to obtain a signature.
Synchronous Return:
Method Access:
Rho.ScreenOrientation.upsideDown()
Rho::ScreenOrientation.upsideDown()
Default: true
Property Access:
Rho.ScreenOrientation.autoRotate
Rho::ScreenOrientation.autoRotate
function start_detecting_orientation_changes(){ ScreenOrientation.setScreenOrientationEvent(orientation_callback) } function orientation_callback(){ Alert.show_popup("The screen changed orientation") }
def start_detecting_orientation_changes Rho::ScreenOrientation.setScreenOrientationEvent(url_for(:action => :orientation_callback)) end def orientation_callback Alert.show_popup("The screen changed orientation") end
function capture_signature_with_attention_to_details() { // Set screen orientation to upside down Rho.ScreenOrientation.upsideDown(); // At this point, offer the device to the user. You just saved the user the hassle of rotating the tablet // and there's less potential for the device to be dropped along the way Rho.Signature.takeFullScreen({}, signature_callback); } function signature_callback(params) { // do whatever we need to do with the signature ... // restore screen orientation to default Rho.ScreenOrientation.normal(); }
def capture_signature_with_attention_to_details # Set screen orientation to upside down Rho::ScreenOrientation.upsideDown # At this point, offer the device to the user. You just saved the user the hassle of rotating the tablet # and there's less potential for the device to be dropped along the way Rho::Signature.takeFullScreen({}, url_for(:action => :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 autorotate Rho.ScreenOrientation.autoRotate=true; // Disable autorotate Rho.ScreenOrientation.autoRotate=false;
# Enable autorotate Rho::ScreenOrientation.autoRotate=true # Disable autorotate Rho::ScreenOrientation.autoRotate=false