Screen Orientation Help

I have an app that requires the width and height values to be used when the orientation of the screen is changed. The values are not updated to the variables until the second screen rotation. It’s like it is one step behind all the time. Can anyone shed some light on this? It’s really annoying and I have tried all sorts of methods to work around it including saving values in a TinyDB and changing screen to retrieve the values. Help please. There must be some way to do this so the correct values are shown. I have tried this on 3 devices with the same results. Thanks.



Try this one ScreenHeightWidth.aia (2.5 KB)

I use both modes in one of my applications.
works properly.
In addition, I respond to changes in size when dividing the screen in every possible case.

You just have to remember one important thing. Depending on the screen scaling, the application may be restarted.
Therefore, size reading must be placed in the screen initialization block.
In addition to the standard block “screen orientation”.

I also have an additional timer to check the screen size.

Thank you. I didn’t think of using the clock. It’s fixed.
… Andrew !!

1 Like

Hallo,

I run into the same problem. Can you please explain how you fixed this. I don’t want to use a clock as well.
Thanx

I spent many hours … MANY … trying to find a non-clock solution. Just doesn’t work. You find something that will work on a phone, and it doesn’t work on the tablet, or the other way around. I just gave up and made my app portrait. Sorry. Love to hear if you find something.

Oh … the one which partially worked is using a base screen (screen1) option where when you change screen orientation you return to screen1 with a value of the screen name you just came from, then have a piece of code which returns you to the same screen. When you reopen the screen you were on the initialise block runs. In there you have get screen width and height. But like I said, works on some devices but not on some.

Ok, thank you for reply.
My app should run in all directions. So I have to use the workaround until it’s fixed.

Have you try this before?

https://docs.kodular.io/components/screen/#screen-orientation-changed