aaronk Well-Known Member Licensed User Longtime User Jul 21, 2012 #1 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?
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?
Erel B4X founder Staff member Licensed User Longtime User Jul 21, 2012 #2 You should use a single layout file with two layout variants. One for portrait and another for the landscape. Upvote 0
You should use a single layout file with two layout variants. One for portrait and another for the landscape.
aaronk Well-Known Member Licensed User Longtime User Jul 21, 2012 #3 is there code you can use to detect if the user is currently viewing it in portrait or landscape ? Upvote 0
klaus Expert Licensed User Longtime User Jul 21, 2012 #4 Chapter 19.5 Detect screen orientation in the Beginner's Guide. Best regards. Upvote 0
aaronk Well-Known Member Licensed User Longtime User Jul 22, 2012 #5 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
Thanks.. I think you where meant to say Chapter 19.25 I have taken a look and looks like what I am after.
klaus Expert Licensed User Longtime User Jul 22, 2012 #6 Sure chapter 18.25 Best regards. Last edited: Mar 13, 2019 Upvote 0
G G41 New Member Licensed User Longtime User Jan 22, 2014 #7 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
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"
lemonisdead Well-Known Member Licensed User Longtime User Jan 22, 2014 #8 In B4ACodeSnippets you will find 2.36 Get the current screen orientation in the code Upvote 0
klaus Expert Licensed User Longtime User Jan 22, 2014 #9 If you look at the date of post #6 it's quite old. The Beginner's Guide has been updated since this date. Look at chapter 18.25. Last edited: Mar 13, 2019 Upvote 0
If you look at the date of post #6 it's quite old. The Beginner's Guide has been updated since this date. Look at chapter 18.25.
mmieher Active Member Licensed User Longtime User Mar 13, 2019 #10 I need to read this too. I cannot find chapter 17.25? Downloaded Beginners Guide afresh from https://www.b4x.com/b4a.html#documentation Upvote 0
I need to read this too. I cannot find chapter 17.25? Downloaded Beginners Guide afresh from https://www.b4x.com/b4a.html#documentation
JonPM Well-Known Member Licensed User Longtime User Mar 13, 2019 #11 mmieher said: I need to read this too. I cannot find chapter 17.25? Downloaded Beginners Guide afresh from https://www.b4x.com/b4a.html#documentation Click to expand... Just search the glossary. Detect screen orientation is 18.25 Upvote 0
mmieher said: I need to read this too. I cannot find chapter 17.25? Downloaded Beginners Guide afresh from https://www.b4x.com/b4a.html#documentation Click to expand... Just search the glossary. Detect screen orientation is 18.25
mmieher Active Member Licensed User Longtime User Mar 13, 2019 #12 Thank you, JonPM. I need to start a new thread ... Upvote 0
klaus Expert Licensed User Longtime User Mar 13, 2019 #13 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
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