Page 1 of 1

vScroller doesn't restores to prev loc

Posted: Tue Jul 29, 2014 7:40 pm
by Jellobus
Hi All :D

I am testing with a native scroller on the device. I am able to create scroller but I found couple of problems with it..

Platform:Android
1. location of vScroll is not properly restores to its previous location after coming back from other cards.
(Field "content" of group "scrollarea" restores to its prev location but vScroll doesn't)
2. Can not find a way to check whether vScroller is at the end or not.

I attached the scroll stack so please see attached file. Please check and let me know if you have any idea.. :)

Thanks in advance!

Louis

Re: vScroller doesn't restores to prev loc

Posted: Wed Jul 30, 2014 4:56 am
by Simon
Hi Louis,
Ohh yeah, lots of problems in that stack, but no problem, easy fixes.
First remove all mobileControlSet that are listed as iOS only, it's in the dictionary.
Add these to the top of the card;

Code: Select all

local oldScroll
local sScrollerID1
Yes, I know you set sScrollerID1 to a local but you set it inside a handler. Remove it from inside the handler.
Then in your removeScroller handler change to this;

Code: Select all

mobileControlDelete "sScrollerID1"
Sure the dictionary say's you can use it's name, maybe you can I just didn't test it. You'd have to make the name a local as well I think.
OK so that gets you set to do the return from the other card and sets the vscroll correctly.
Good?
Great :)

Now the scrollbarEnd, it's only for a liveCode scrollbar not native
To figure out when you are at the end you have to... ok ready
(the field height + the field margin) - the grp height
In this stack it is
(1334 + 8 ) - 500
to actually see it change this line in scrollerDidScroll

Code: Select all

  else
      put vOffset into field "scrollerLocation"
      --put empty into field "scrollerLocation"
   end if
scrolling down to the bottom will show you 842

phew, what fun!

Simon
Edit; Great example stack showing the problem, easiest way to help find the problem.

Re: vScroller doesn't restores to prev loc

Posted: Wed Jul 30, 2014 1:39 pm
by Jellobus
Hi Simon, 8)

Wow. That's perfect! Its like a miracle happened to my stack! Thanks Simon for your detailed advice! No more struggling with scroller :mrgreen: Now I am going to grab some coffee to refresh my head!

Thanks!!!

Louis