The guaranteed solution for screen scaling?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
oellph
Posts: 2
Joined: Thu Jul 28, 2016 6:28 am

The guaranteed solution for screen scaling?

Post by oellph » Tue Oct 11, 2016 1:45 pm

I've seen multiple posts and suggestions but haven't found *the* solution that works perfectly for mobile screen scaling. Given the importance of mobile apps, this should really be front and centre of the official mobile guidance. So what's the consensus on the guaranteed solution to make a Livecode app scale appropriately on Android and iOS?

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

Re: The guaranteed solution for screen scaling?

Post by jacque » Tue Oct 11, 2016 8:08 pm

There isn't a single best way because every stack layout is different and requires its own approach. But there are two general methods:

1. The old way: write a resizeStack handler that calculates the screen ratio and loops through all the controls on the card, setting their rects to a new size based on the ratio. Either loop through every card on startup, or resize on preOpenCard as the user navigates. The more complex the stack, the bigger pain this becomes. Handlers can be unweildy and tedious to write, but results are often good if the handler is carefully written.

2. The new way: depending on your stack layout, choose one of the fullscreenMode settings. This lets LiveCode scale the stack automatically, not only the controls but the text in fields and labels as well. I prefer this method. It requires almost no coding. The issue here is that you need to choose the correct mode based on how your stack is laid out, and during development you need to keep in mind where the controls will be located on the mobile screen. Usually noBorder or showAll are the best choices on mobile because they preserve the original stack size ratio, but some stacks may work better with a different choice.

It boils down to experimentation and an awareness of how each mode works.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

SusanB
Posts: 111
Joined: Mon Nov 07, 2011 4:10 am
Contact:

Re: The guaranteed solution for screen scaling?

Post by SusanB » Tue Oct 25, 2016 10:00 pm

I'm wondering why "set the fullscreenmode of stack to letterbox" works only on the opening and subsequent portrait orientations, but not for the landscape orientations which are too small still. Is there further tweeking needed to be done? Using LC 8.1.1

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: The guaranteed solution for screen scaling?

Post by FourthWorld » Tue Oct 25, 2016 10:18 pm

While fullScreenMode is indeed a more recent addition to the language, I wouldn't want to give newcomers the impression that alternatives are necessarily obsolete.Both are very useful, but which is "best" will often depend on the specifics of the app:
http://forums.livecode.com/viewtopic.ph ... 22#p147391
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SusanB
Posts: 111
Joined: Mon Nov 07, 2011 4:10 am
Contact:

Re: The guaranteed solution for screen scaling?

Post by SusanB » Wed Oct 26, 2016 3:05 am

Well I'll be! I just answered my own question as I went back in time to when I was having the same problem. From a previous post of quite awhile ago: "Thank you , Dave! It turns out I had the setting of each card's "set the width and height" within "If environment is development". I commented out the "if environment is development "in the preopencard script of each card, and everything is now fine. What a relief!!

And it is a relief again. Not sure why this same app had the same problem that I supposedly fixed, but I'm not going to give it another thought.

Post Reply