Android open stack in different orientation

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Android open stack in different orientation

Post by bsouthuk » Mon Mar 23, 2015 5:23 pm

Hi

My android APP is used in landscape (which is the main stack), however when a certain substack opens, this particular stack is needs to be portrait.

Problem I am having here is the stack that needs to open in portrait actually opens in landscape even though I have the following code:

Code: Select all

     -- Condition to check whether the environment is mobile

on preOpenStack
   if the environment is "mobile" then
         //set the fullscreenmode of this stack to "ExactFit"
     --Portrait , Portrait Upside Down , Landscape Left, Landscape Right are the 4 Parameters to be passed in the function iphoneSetAllowedOrientations
     put "portrait,portrait upside down" into theallowed
     -- Function Call
    mobileSetAllowedOrientations theallowed
  end if
end preOpenStack
It is only when you tilt the device it then changes to portrait and does then does not allow to revert to landscape. Is there a way the stack can open in portrait without having to tilt the device first

Many thanks

Daniel

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Android open stack in different orientation

Post by jacque » Tue Mar 24, 2015 6:13 pm

Just a guess, but it may be too late to set the orientation in preOpenStack because at that point the stack has already been loaded into RAM. Try setting the orientation in the handler that goes to the stack.

Another guess: set it in an OrientationChanged handler. That is sent before the stack gets loaded.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ramav
Posts: 20
Joined: Tue Jan 06, 2009 4:56 am

Re: Android open stack in different orientation

Post by ramav » Fri May 29, 2015 6:39 pm

This is really a LiveCode bug that needs to be fixed, else all users, newbie and experienced, can run into a blank wall of frustration! I wish LC would document and update these issues in their on-line dictionary so there is an authoritative place to find the solutions. I had to do hours of searching when I literally stumbled upon the solution:
for mobileSetAllowedOrientations orientations, NO SPACES are allowed between orientation names after the comma separator!!!!!
Thus, "portrait, portrait left, portrait right" is NOT OK (insidious, space after both first and second commas) but "portrait,portrait left,portrait right" works, at least in LC 6.7.4

Post Reply