[mobile:Android] mobileSetAllowedOrientations gives error

Roger Eller roger.e.eller at sealedair.com
Sun Jun 5 11:47:05 EDT 2011


On Fri, Jun 3, 2011 at 12:02 PM, J. Landman Gay wrote:

> On 6/3/11 10:10 AM, Nonsanity wrote:
>
>> Am I wrong in thinking this command doesn't exist unless the stack is
>> running in a mobile environment? In other words...
>>
>> on preOpenStack
>>     if the environment is "mobile" then
>>         mobileSetAllowedOrientations "portrait"
>>     end if
>> end preOpenStack
>>
>> ...Will prevent errors when running in the IDE on Windows or Mac, but will
>> limit the orientations to portrait-only when running on iOS or Android..?
>>
>
> Yes, I'm sure that's the problem. (Roger, don't use parens, it's a
> command.)
>
>
>  Personally, I'd prefer the language to skip over such commands gracefully
>> instead of crashing the script when the environment is wrong. Otherwise
>> the
>> programmer has to encase every such command in an environment check.
>>
>
> Agreed, it's a pain. It's a little quicker to write a custom function and
> call that, though not by much:
>
> function mob
>  return the environment = "mobile"
> end mob
>
> Then all you have to write is: if mob() then...
>
> But still, we shouldn't have to.
>
> --
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com


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. Anything after
the comma is ignored.  Also, I want my  default orientation to be "landscape
right", but it is always portrait.  My device is a widescreen Android
tablet, and this is the landscape feels more natural for the device. Having
to physically turn the device to portrait and back just to get a default is
annoying.

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?

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

˜Roger



More information about the use-livecode mailing list