Orientation Support Mobile

Mike Kerner MikeKerner at roadrunner.com
Mon Sep 8 14:30:08 EDT 2014


Try this:
1) create a stack
2) set the dimensions to ipad (1024x768), just because
3) Set the background color to whatever you want
4) Toss a button on the top, left, right, and bottom, just so you can have
a reference point
5) set standalone for your mobile platform (i did ios, and targeted ipad)
6) Test

Now rotate the screen around
Everything looks ok, with the exception of the buttons not moving around
(which is fine, that wasn't the point - the point was that this looks like
we expected it to look)

NOW, go into the stack script
on preOpenStack
   mobileSetAllowedOrientations "portrait"
end preOpenStack


Now rotate the simulator so it is in either left or right landscape, exit
the app, and test again.

The simulator will re-orient itself into portrait, with a 254 pixel black
bottom border.

On the device, it does indeed orient the app in portrait, even if the
device is sitting in landscape, with the black border occupying the bottom
254 or so pixels.


On Mon, Sep 8, 2014 at 1:57 PM, Mike Kerner <MikeKerner at roadrunner.com>
wrote:

> Also, Ralph, to your original suggestion, I'm not looking to support
> orientation changing, initially, I'm looking to have some cards render one
> way and some the other way.  When you have everything accept both
> orientations, you wind up with a situation where you also have to move
> controls to support the keyboard on the bottom of the screen, especially in
> landscape.
>
> On Mon, Sep 8, 2014 at 1:23 PM, Mike Kerner <MikeKerner at roadrunner.com>
> wrote:
>
>> Yes, I know I can see what the orientation is, but it's the forcing of
>> some cards to render a certain way, no matter what that is causing a
>> problem.
>>
>> On Mon, Sep 8, 2014 at 1:02 PM, Ralph DiMola <rdimola at evergreeninfo.net>
>> wrote:
>>
>>> Mike,
>>> When you are processing the resizestack message you can determine the
>>> orientation using mobileOrientation(). Or better use my PorL() function(included
>>> in the simulcast materials) so you can test in the IDE and know what it
>>> will look like on the mobile device.
>>>
>>> Ralph DiMola
>>> IT Director
>>> Evergreen Information Services
>>> rdimola at evergreeninfo.net
>>>
>>>
>>> -----Original Message-----
>>> From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On
>>> Behalf Of Mike Kerner
>>> Sent: Monday, September 08, 2014 9:48 AM
>>> To: How to use LiveCode
>>> Subject: Re: Orientation Support Mobile
>>>
>>> Thanks, Ralph, now I have something else to try, today!
>>>
>>> On Mon, Sep 8, 2014 at 1:39 AM, Ralph DiMola <rdimolad at evergreeninfo.net
>>> >
>>> wrote:
>>>
>>> > Mobile Orientation change cookbook:
>>> > 1. Device is flipped.
>>> > 2. The resizestack message is sent before the card is rendered
>>> > (orientationchanged message is sent after).
>>> > 2. In the resizestack handler reposition your controls.
>>> > 3. During this message no screen updates are done.
>>> > 4. The user will see the screen flip with the previous layout.
>>> > 5. When the resizestack message completes the new layout is rendered.
>>> > 6. Pass the resizestack message after repositioning your controls or
>>> > strange things will occur.
>>> >
>>> > This works equally well with both Android and iOS.
>>> >
>>> > Now I don't know how this works if you're changing cards as I
>>> > reposition controls on the same card. I would guess opening a new card
>>> > in the resizestack message will yield similar results.  I will try it
>>> > when I get back.
>>> >
>>> > Ralph DiMola
>>> > IT Director
>>> > Evergreen Information Services
>>> > rdimola at evergreeninfo.net
>>> >
>>> >
>>> >
>>> >
>>> > <div>-------- Original message --------</div><div>From: Mike Kerner <
>>> > MikeKerner at roadrunner.com> </div><div>Date:09/07/2014  20:38
>>> > (GMT-08:00)
>>> > </div><div>To: How to use LiveCode <use-livecode at lists.runrev.com>
>>> > </div><div>Subject: Re: Orientation Support Mobile </div><div>
>>> > </div>Well, for starters:
>>> > 1) You can't seem to force LC to render a card in one orientation or
>>> > the other and then understand what you're forcing it to do.  There
>>> > doesn't seem to be a command to do it.  MobileSetAllowedOrientations
>>> > doesn't help.  So if you support P and L, but certain cards are one
>>> > way and certain the other, and the app opens in the one you didn't
>>> want, you have an issue.
>>> > Let's say you do mobileSetAllowedOrientations to portrait, and you
>>> > flip the device sideways.  When you open the app, the app will render
>>> > in portrait, but it will think that its width and height are for
>>> > landscape, which makes rendering a bit challenging.
>>> > 2) How do you lay out your cards for P and L?  You could have custom
>>> > properties, (do it the old MG way, before MG stopped supporting
>>> > rotating), but that creates a layout issue, in that you have to build
>>> > the properties for as many objects as you have on a card, and then
>>> > deal with rearranging the layout when the orientation changes.
>>> > 3) If you try to overcome #2 with a substack for P and a substack for
>>> > L, then you have an event issue, because going from card 1 of substack
>>> > P to card 2 of substack L isn't going to send a closeCard event to
>>> > card 1 of substack P, which means that if you were using closeCard to
>>> > dispose of your native controls...you have to do something else, and
>>> > the transition isn't smooth.
>>> > 4) There are issues with getting LC to render objects consistently
>>> > when switching orientations, which I would imagine is why John stopped
>>> > supporting orientation switching in MG.  Sometimes, when you rotate
>>> > the device, not everything goes where one might hope it would.  I
>>> > still haven't gotten to the bottom of that one.
>>> >
>>> >
>>> >
>>> > On Sun, Sep 7, 2014 at 10:04 PM, Colin Holgate <coiin at verizon.net>
>>> wrote:
>>> >
>>> > > I have used landscape and portrait in the same app outside of
>>> > > LiveCode, and certainly ran into issues. I think that in LiveCode
>>> > > you would want to enable all orientations, then listen for the
>>> orientationChanged message.
>>> > > Then, in theory, you could react accordingly.
>>> > >
>>> > > Can you go into more detail about issues you’ve hit?
>>> > >
>>> > >
>>> > >
>>> > > _______________________________________________
>>> > > use-livecode mailing list
>>> > > use-livecode at lists.runrev.com
>>> > > Please visit this url to subscribe, unsubscribe and manage your
>>> > > subscription preferences:
>>> > > http://lists.runrev.com/mailman/listinfo/use-livecode
>>> > >
>>> >
>>> >
>>> >
>>> > --
>>> > On the first day, God created the heavens and the Earth On the second
>>> > day, God created the oceans.
>>> > On the third day, God put the animals on hold for a few hours,
>>> >    and did a little diving.
>>> > And God said, "This is good."
>>> > _______________________________________________
>>> > use-livecode mailing list
>>> > use-livecode at lists.runrev.com
>>> > Please visit this url to subscribe, unsubscribe and manage your
>>> > subscription preferences:
>>> > http://lists.runrev.com/mailman/listinfo/use-livecode
>>> > _______________________________________________
>>> > use-livecode mailing list
>>> > use-livecode at lists.runrev.com
>>> > Please visit this url to subscribe, unsubscribe and manage your
>>> > subscription preferences:
>>> > http://lists.runrev.com/mailman/listinfo/use-livecode
>>> >
>>>
>>>
>>>
>>> --
>>> On the first day, God created the heavens and the Earth On the second
>>> day, God created the oceans.
>>> On the third day, God put the animals on hold for a few hours,
>>>    and did a little diving.
>>> And God said, "This is good."
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>>
>>
>> --
>> On the first day, God created the heavens and the Earth
>> On the second day, God created the oceans.
>> On the third day, God put the animals on hold for a few hours,
>>    and did a little diving.
>> And God said, "This is good."
>>
>
>
>
> --
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>    and did a little diving.
> And God said, "This is good."
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list