Native Scroller on Android

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

Native Scroller on Android

Post by joel.epsteinBUS31vi » Sun Dec 14, 2014 3:52 am

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
Attachments
scrollArea.livecode.zip
(2.95 KiB) Downloaded 251 times

strongbow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 146
Joined: Mon Jul 31, 2006 1:39 am
Contact:

Re: Native Scroller on Android

Post by strongbow » Sun Dec 14, 2014 11:15 am

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

joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

Re: Native Scroller on Android

Post by joel.epsteinBUS31vi » Sun Dec 14, 2014 4:25 pm

Thanks, Alan.

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

Joel

Post Reply