The guaranteed solution for screen scaling?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
The guaranteed solution for screen scaling?
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?
Re: The guaranteed solution for screen scaling?
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.
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
HyperActive Software | http://www.hyperactivesw.com
Re: The guaranteed solution for screen scaling?
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
-
- VIP Livecode Opensource Backer
- Posts: 10044
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: The guaranteed solution for screen scaling?
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
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: The guaranteed solution for screen scaling?
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.
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.