Orientation Change

I remember easing in something about a function on orientation change and to change the code accordingly. Can someone link me to some help?

If I understand you correct, check for supportedOrientations(…) in the reference.

I know about that. All I remember was that it said that codea has some basic functions. That is function setup, draw, touch, collide, and the one about orientation. The only reason I need this is because the buttons in my project aren’t moving. In my landscape orientation, the buttons are set in the corner, however in the portrait view, their in the middle of the screen. I need them to be in the corner for both orientations. If only there was a buttonMode()

@Andrew_Stacey thanks that’s what i was looking for!!

There’s a function orientationChanged which is called when the orientation changes. It’s argument is the new orientation.

Hi @veeerlap,

Still working on your Flood-it app?

I tried the OrientationChanged() function but couldn’t quite get the hang of it. In the end I opted for checking the orientation, by checking WIDTH and using variables for the button positioning and touch detection.

I am putting the finishing touches to my version - will post soon. Have problem with development at moment as better half on 6 week summer hols and likes my attention. Will post a vid of my progress but code not nearly ready enough to post yet.

Good luck with it.

Bri_G

:smiley:

A related question. Is supportedOrientation supposed to persist between projects? For example, after trying out Cargobot in the new version I went back to my old code and the supportedOrientations(PORTRAIT_ANY) had persisted and was only able to run my program in portrait until I added the supported orientation command to my own code. Is this intentional?

Hello @West. Thank you - I thought I had imagined what I had experienced, but you have explained its origins. I have added something to the issue tracker.