DeviceData.Orientation

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Read-Only Property (As DeviceData.Orientations )
DeviceData.OrientationsValue = aDeviceData.Orientation

New in 2020r2

Supported for all project types and targets.

The orientation of the device.

Notes

This allows you to determine the orientation of the device relative to the Earth. See Orientations for all possible orientations. MobileScreen.OrientationChanged event will be called anytime the orientation changes which is a likely place to access the Orientation property. However, you can access it at any other time.

Sample Code

This example displays a message box if the device is face down:

If System.Device.Orientation = System.DeviceData.Orientations.FaceDown Then
MessageBox("Why are you ignoring me?")
End If

See Also

Orientations enumeration, MobileScreen.OrientationChanged event.