MobileOrientation problem

The place to discuss anything and everything about running your LiveCode on Android

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
Posts: 100
Joined: Fri Oct 14, 2011 6:53 am

MobileOrientation problem

Post by » Tue Nov 21, 2017 3:30 pm

The problem, the short version ....

I have two substacks where I have put:
"mobileSetAllowedOrientations portrait, Landscape left"
one is in layout "portrait mode" and one is in layout "Landscape mode" so I can switch between them by tilting the phone. (Close one stack open another etc etc). Each subStack is a single card stack with no buttons (the user have to use the hardware button to go back).

The purpose is to show a list in portrait mode and by tilting the phone, open another subStack with a more detailed list in landscape mode.

so far so good...

Now to the problem!
When I close the subStack and return to my mainStack (this is always done from the subStack which is in portrait mode), I set both: "mobileSetAllowedOrientations portrait" and "mobileLockOrientation" on the "MainCard" OpenCard handler.
If I then tilt the phone, the "landscape" subStack opens up, which I think should not be possible.

I use both: "set the destroyStack of this stack to true" and "close stack", but still the subStack/s seems to be active in some way.


Suggestions anyone?

/*Whats all the fuss with c# ?*/

VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4622
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: MobileOrientation problem

Post by jacque » Wed Nov 22, 2017 8:39 pm

LiveCode loads the entire stackfile into RAM when the mainstack opens, and keeps it there until the mainstack completely closes. Because substacks are always in RAM, destroyStack does not apply to them. Only mainstacks can be "destroyed."

You need to check whether conditions are right to allow a substack to open. It's hard to say where you should put that check, but it's likely within the same handler that shows the substacks. I'm not clear on what your mainstack does exactly or how you are managing the orientation changes, but look at wherever that happens and adjust it to determine whether the landscape stack should appear.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software |

Post Reply

Return to “Android Deployment”