Portrait/Landscape

Not sure if this is right but to test for Portrait/Landscape should I be testing the following in the Opening event

if Self.Size.Height > Self.Size.Width Then
  MessageBox("Portrait")
else
  MessageBox("Landscape")
end if

But use this in the new Orientationchanged event

if Self.Size.Height < Self.Size.Width Then
  MessageBox("Portrait")
else
  MessageBox("Landscape")
end if

No you should be using https://docs.xojo.com/MobileScreen.ContentSize instead of Self.Size

2 Likes

If you’re using a split screen, Self only refers to part of the screen and your code won’t work.

1 Like