Orientation: Difference between revisions
Line 9: | Line 9: | ||
== Properties and Methods == | == Properties and Methods == | ||
The Orientation control has | The Orientation control has the following properties: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |||
| messageLandscape || Text displayed when rotated. Must be just 1 line. | |||
|- | |||
| messagePortrait || Text displayed when rotated. Must be just 1 line. | |||
|- | |- | ||
| screenOrientation || Normal orientation: Portrait or Landscape. Design time only. | | screenOrientation || Normal orientation: Portrait or Landscape. Design time only. |
Revision as of 13:24, 15 September 2013
Description
The Orientation control puts up a full screen message if the orientation changes. If your app is only designed to run in Portrait mode and the user rotates to Landscape, it will black out the screen and ask the user to rotate back. The previous content of the screen will display once this happens. It can also be set to make Landscape the allowed orientation.
To use it, select it from the controls in the Toolbox so it gets added to the Project Explorer. It will not show on the Design Screen. To remove it, highlight it in the Project Explorer and delete.
Properties and Methods
The Orientation control has the following properties:
messageLandscape | Text displayed when rotated. Must be just 1 line. |
messagePortrait | Text displayed when rotated. Must be just 1 line. |
screenOrientation | Normal orientation: Portrait or Landscape. Design time only. |
Example
While no code is needed to use this control, here are a some useful functions for dealing with orientation.
To get the current orientation:
MsgBox "window.orientation = " & window.orientation
To execute code when the orientation changes:
Function window_onorientationchange() 'This function is called if the orientation of the device is changed. MsgBox "orientation changed to " & window.orientation End Function
Output
If the screenOrientation is "portrait", the message above will be displayed when the screen is rotated.