[mobile:Android] mobileSetAllowedOrientations gives error

J. Landman Gay jacque at hyperactivesw.com
Sun Jun 5 13:53:05 EDT 2011


On 6/5/11 10:47 AM, Roger Eller wrote:

> I am seeing some strange things.
>
> The release notes say:
> -- Here orientations must be a comma-delimited list consisting of at least
> one of
> -- portrait, portrait upside down, landscape left and landscape right.
>
> So, I have this in preOpenStack:
>
> if the environment is "mobile" then
>     mobileSetAllowedOrientations "landscape right, portrait, portrait upside
> down, landscape left"
> end if
>
> I have discovered that ONLY the first orientation is honored.

Remove the spaces before each comma. The engine is very literal about 
these. All (supported) orientations work for me.

> Also, I want my  default orientation to be "landscape
> right", but it is always portrait.

Yes, I see that too. I think initial orientation isn't supported yet, we 
aren't on par with iOS at this point.

> I'm seeing that "portrait" and "portrait upside down" are interpreted as
> opposites of what they should be. When I have this script in my stack,
> holding the device in portrait orientation, the OS menubar is upside down at
> the bottom of the screen. Rotating the device 180, the menubar moves to the
> bottom again and is still upside down. Both lacdscape orientations are
> correct with the menubar at the top.  What's up with that?

My OS is too early to support all four orientations, but maybe if you 
fix the comma-space issue mobileSetAllowedOrientations it will fix itself?

>
> This script is allowing all 4 orientations to be used, but the portrait
> orientations are still backwards.
>
> on orientationChanged
>     put mobileDeviceOrientation() into tRot
>     mobileSetAllowedOrientations (tRot)
>     mobileUnlockOrientation
>     resizeStack
> end orientationChanged

OrientationChanged is sent before orientation actually happens, so tRot 
will be the same orientation that it was before. Resizestack is sent 
after a change in orientation, so you can probably remove the handler 
above and just catch the change in a resizestack handler. Resizestack 
will report the actual, new orientation.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list