Page 1 of 1

Scrolling and Autoscaling - How can I do both?

Posted: Mon Dec 23, 2013 5:11 am
by cdimoff
Hi guys,

I was overjoyed to see "autoscaling" as part of livecode's 6.5 update. I have been able to make my apps scale/resize so much easier with only 3 lines of code. My question is how do I make my apps scale/resize with a scroller?

I can make my apps scroll just fine using the "create a native scroller to scroll text fields" tutorial

However when I add the 3 lines of code to make my apps scale/resize the "scroll area" stays small (about half of the screen) with the horizontal scroll bar staying at about halfway on the screen. I can scroll it like this (by just touching in the top half of the screen) for a while, but then it eventually stops showing the "blue haze" that indicates you have scrolled all the way-even though I still have more to go.

This is the code I use to make the stack resize:

Code: Select all

on preOpenStack
set the fullscreenmode of me to "exactFit"
end preOpenStack
Very frustrating so any/all help is appreciated! Thanks

P.S: I am testing on an android-galaxy s4 but want to make this app work on both ios and android.

Re: Scrolling and Autoscaling - How can I do both?

Posted: Mon Dec 23, 2013 11:46 am
by splash21
Hi, cdimoff. Is the code definitely in the stack script? It works OK here, but if I put the code in the card script instead, it doesn't - just a thought. :)

Re: Scrolling and Autoscaling - How can I do both?

Posted: Thu Jun 12, 2014 10:01 am
by viro
Sorry for digginng this one out. But I can't figure out why my textfield can scroll completly while an image does...

Re: Scrolling and Autoscaling - How can I do both?

Posted: Thu Jun 12, 2014 6:39 pm
by Simon
Hi viro,
The first problem is you have the size and position locked on the field "lorem", unlock that. Only the group should be locked.
For the first card put the script into an openCard handler (not preOpenCard) it seems to work better.
Yor script:
put 0,0,(the formattedWidth of field "lorem"),(the formattedHeight of field "lorem") into tContentRect
should be
put 0,0,(the formattedWidth of group "scrollArea"),(the formattedHeight of group "scrollArea") into tContentRect

Simon

Re: Scrolling and Autoscaling - How can I do both?

Posted: Fri Jun 13, 2014 9:20 am
by viro
Ty Simon, I followed your suggestions, Text didnt scroll to the end because it wasnt expanded to full size :roll:
Image has been misplaced in the middle, correcting it to topleft sorted out this problem too!

There's a difference when using formatted size of fld or of grp
when using grp there's plenty of whitespace after scrolling..

Re: Scrolling and Autoscaling - How can I do both?

Posted: Fri Jun 13, 2014 9:50 am
by Simon
Try this in button "contGroup":

Code: Select all

   // Nur auf mobilen Geräten erstellen
   if environment() is not "mobile" then exit mouseup
   set the height of fld "lorem" to the formattedHeight of fld "lorem" --new line
   set the top of fld "lorem" to the top of grp "scrollArea" --newLine
   // Bereich des Scrollers
   put the rect of group "scrollArea" into tScrollerRect
Simon