Load Layout based on screen rotate

Status
Not open for further replies.

aaronk

Well-Known Member
Licensed User
Longtime User
Hello,

Just wondering how to change the Page Layout to another Layout based on the screen rotate..

I know how to display my Layout:

Code: Copy
Activity.LoadLayout("MyLayout1")

However if the user has the device in Portrait mode I want to display a layout called 'Portrait': Activity.LoadLayout("Portrait")

But if the user rotates the device to landscape I want to display a different layout called 'Landscape': Activity.LoadLayout("Landscape")

Is there such way of doing this. (I know about the Designer Scripts but I want to display a different Layout all together)

I am looking for a place to detect if the device has been rotated and if so what way.

Any ideas?
 
is there code you can use to detect if the user is currently viewing it in portrait or landscape ?
 
Upvote 0
Thanks.. I think you where meant to say Chapter 19.25

I have taken a look and looks like what I am after.
 
Upvote 0
Help me to understand. The copy of my beginner's guide edition 2.6 that I just downloaded from the website comes up in Chapter 18 "Glossary"
 
Upvote 0
In B4ACodeSnippets you will find 2.36 Get the current screen orientation in the code
 
Upvote 0
In the last version of the beginner's Guide it's chapter 18.25.

The code is the following:
Code: Copy
Sub Globals
    Private Orientation As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
    If Activity.Width > Activity.Height Then
        Orientation = "Landscape"
    Else
        Orientation = "Portait"
    End If
End Sub
 
Upvote 0
Status
Not open for further replies.
Back
Top