×
Namespaces

Variants
Actions

Changing display orientation in Symbian Web Runtime

From Nokia Developer Wiki
Jump to: navigation, search

This code snippet shows how to change the orientation of the display to "Portrait" or "Landscape".

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic, Nokia 6220 Classic
Compatibility
Platform(s): S60 5th Edition, S60 3rd Edition FP2
S60 5th Edition
S60 3rd Edition FP2
Article
Keywords: widget.setDisplayPortrait(), widget.setDisplayLandscape()
Created: ivruban (26 Feb 2009)
Last edited: hamishwillee (04 Oct 2012)

Contents

Source file: Relevant HTML components

<input type="button" value="Landscape" onclick="changeToLandscape();" />
<input type="button" value="Portrait" onclick="changeToPortrait();" />

Source file: JavaScript file

// Changes the orientation to landscape
function changeToLandscape() {
if (window.widget.isrotationsupported) {
window.widget.setDisplayLandscape();
} else {
alert("Display rotating is not supported.");
}
}
 
// Changes the orientation to portrait
function changeToPortrait(){
if (window.widget.isrotationsupported) {
window.widget.setDisplayPortrait();
} else {
alert("Display rotating is not supported.");
}
}

Postconditions

After starting the widget, the buttons "Landscape" and "Portrait" are shown.

  • To change the display orientation to landscape, click the "Landscape" button.
  • To change the display orientation to portrait, click the "Portrait" button.

Supplementary material

This code snippet is part of the stub concept, which means that it has been patched on top of a template application in order to be more useful to developers. The version of the WRT stub application used as a template in this snippet is v1.1.

This page was last modified on 4 October 2012, at 08:57.
78 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×