vScroller doesn't restores to prev loc

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

vScroller doesn't restores to prev loc

Post by Jellobus » Tue Jul 29, 2014 7:40 pm

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
Attachments
scroller.zip
VScroll location problem
(2.38 KiB) Downloaded 166 times

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: vScroller doesn't restores to prev loc

Post by Simon » Wed Jul 30, 2014 4:56 am

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.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: vScroller doesn't restores to prev loc

Post by Jellobus » Wed Jul 30, 2014 1:39 pm

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

Post Reply