Page 1 of 1

Native Scroller on Android

Posted: Sun Dec 14, 2014 3:52 am
by joel.epsteinBUS31vi
Hi all -

I'm having a problem with Native Scrollers on Android devices (4.x; Galaxy 5; Nexus 7) using LiveCode 7.01 rc3.

The issue is that I can scroll all the way down, but I can never scroll all the way back to the top.

This code:

Code: Select all

local sScrollerID

on preOpenCard
   local tScrollerRect, tContentRect
   if environment() is not "mobile" then exit preOpenCard
   
   put the rect of group "scrollArea" into tScrollerRect
   
   put the left of field "Entry",the top of field "Entry",the right of field "Entry",the bottom of field "Entry" into tContentRect
   
   mobileControlCreate "scroller", "loremScroll"
   put the result into sScrollerID
   
   mobileControlSet "loremScroll", "rect", tScrollerRect
   mobileControlSet "loremScroll", "contentRect", tContentRect
   mobileControlSet "loremScroll", "visible", true
   mobileControlSet "loremScroll", "scrollingEnabled", true
   mobileControlSet "loremScroll", "vIndicator", true
   mobileControlSet "loremScroll", "vscroll", 0
end preOpenCard

on closeCard
   if environment() is not "mobile" then exit closeCard
   mobileControlDelete sScrollerID
end closeCard

on scrollerDidScroll hOffset, vOffset
   set the vScroll of group "scrollArea" to vOffset
end scrollerDidScroll
works great on iOS, but on Android I can scroll down to the bottom, but I cannot scroll all the way back up to the top.

I'd be ever so grateful if someone can provide some advice as to how I can fix this problem.

Peace.

Joel

Re: Native Scroller on Android

Posted: Sun Dec 14, 2014 11:15 am
by strongbow
Pretty sure you need to use:

put 0,0,the formattedWidth of fld "Entry", the formattedHeight of fld "Entry" into tContentRect

for your contentRect.

HTH

Alan

Re: Native Scroller on Android

Posted: Sun Dec 14, 2014 4:25 pm
by joel.epsteinBUS31vi
Thanks, Alan.

I truly appreciate your speedy and helpful reply. That certainly seemed to do the trick.

Joel