Orientation help needed

I used it, but It only gives value of screen orientation selected in designer.

it depends how you have used it, show your blocks

Used in two ways but there is same result,

what value you have got in label?


1 Like

if width > length
then “landscape”
else “portrait”



May be you have to set the sensor mode of screen in your app

this will not help, see the documentation Screen - Kodular Docs


Yup I got it…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

I do not understand your answer to this. I want to hide some fields when the phone is rotated horizontally (Example: Horizontal_Arrangement1). I want the hidden area to be visible when turning back to vertical from horizontal.

I just wanted to understand this section.
" if width (?) > length (?) "

@Omer_Turhan the device is in landscape, if the width of the screen is larger than the height of the screen

graphic found here


First, I made the Screen Orientation “Full Sensor” in the design. Later

". ScreenOrientationChanged
-If screen.width > screen.height

  • then set.screen.screenorientation to Landscape
  • else set.screen.screenorientation to Portrait"

When I apply these codes, the screen is constantly “horizontal, vertical, horizontal, vertical …”. The screen is not stable.

The sensor seems to be a little problematic. I guess like I have to operate with a button.

do you want the app to work both in Portrait and Landscape?
then there is no need to set the screen orientation in the blocks…
to find out, if the device is currently in Portrait or Landscape, you use this


1 Like

Yes Taifun. There is a small graphic on the screen, when it is rotated horizontally, everything will be hidden and the graphic will have full width and height. Then when rotated vertically, it will revert to its original state. Let me fine the codes again. I think I can handle the buttons. Thank you.It worked when the codes were as follows.

yes, exactly these are the correct blocks

1 Like

I have a question on this subject. If I set “landscape” first of all, will the screen.height and screen.width values ​​change as I think? So the portrait height becomes landscape width?

it you set the screen orientation to landscape, then your device will not change its orientation anymore

which one is screen.height at landscape?

if you change the orientation from portrait to landscape the height will decrement (from portrait to landscape)


1 Like