Orientation Support Mobile
Ralph DiMola
rdimola at evergreeninfo.net
Mon Sep 8 15:01:37 EDT 2014
I have a handler the returns the rect of the card and has an option of returning 1)the remain card area 2) original size but the top is off the screen (negative items 1 and 3) 3) ignore the keyboard altogether. Also an additional offset is implemented. See below.
function getCardRect
local r1 , r2 , r3 , r4 , tR2 , tR4
--return the rect of this card
if the environment is not "mobile" then
put item 1 of the rect of this card into R1
put item 2 of the rect of this card into R2
put item 3 of the rect of this card into R3
put item 4 of the rect of this card into R4
else -- Mobile
if the ignorekeyboard of this stack then
put item 1 of the rect of this stack into R1
put item 2 of the rect of this stack into R2
put item 3 of the rect of this stack into R3
put item 4 of the rect of this stack into R4
else -- Don't Ignore Keyboard
put 0 into R1
put item 3 of the effective working screenrect - item 1 of the effective working screenrect into R3
if the ShrinkKeyboard of this stack then -- Shrink Keyboard
put 0 into R2
put item 4 of the effective working screenrect - item 2 of the effective working screenrect into R4
else -- Don’t but move top off screen
put (item 4 of the effective working screenrect - item 2 of the effective working screenrect) - item 4 of the rect of this stack into R2
put item 4 of the effective working screenrect - item 2 of the effective working screenrect into R4
if the KeyboardOffet of this stack is not empty and the KeyboardOffet of this stack is a number then
put (item 2 of the rect of this stack - the KeyboardOffet of this stack) into tR2
put (item 4 of the rect of this stack - the KeyboardOffet of this stack) into tR4
if tR2 >= R2 then
put tR2 into R2
put tR4 into R4
end if -- Offset out of range
end if -- Keyboard Offset
end if -- Shrink Keyboard
end if --Ignore Keyboard
end if -- Mobile
return (R1,R2,R3,R4)
end getCardRect
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 1:57 PM
To: How to use LiveCode
Subject: Re: Orientation Support Mobile
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."
_______________________________________________
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
More information about the use-livecode
mailing list