Page 1 of 1

Scroller bug!?

Posted: Tue May 14, 2013 10:44 am
by DevBoyLars
Hi there,
I add a scroller to my App and it seems to work fine until I start scrolling :D

I can't scroll to end and if I try to return to the first line of text - I can't. The scroller want get back to start.

Code: Select all

//----------
//Scrollhandler
//----------

local sScrollerID


on preOpenCard
   local tScrollerRect, tContentRect
   
   // Only create a scroller on a mobile device
   if environment() is not "mobile" then exit preOpenCard
   
   
   // Set the area of the scroller
   put the rect of group "scrollArea" into tScrollerRect
   
   
   // Set the are of the content to be scrolled
   put the left of field "scrollText",the top of field "scrollText",the right of field "scrollText",the formattedHeight of field "scrollText" into tContentRect
   
   
   // Create the scroller control
   mobileControlCreate "scroller", "Scroll"
   put the result into sScrollerID
   
   
   // Set the properties of the scroller   
   mobileControlSet "Scroll", "rect", tScrollerRect
   mobileControlSet "Scroll", "contentRect", tContentRect
   mobileControlSet "Scroll", "visible", true
   mobileControlSet "Scroll", "scrollingEnabled", true
   mobileControlSet "Scroll", "vIndicator", false
   mobileControlSet "Scroll", "hIndicator", false
   mobileControlSet "Scroll", "vscroll", 0
end preOpenCard



on closeCard
   // Delete the scroller
   if environment() is not "mobile" then exit closeCard
   mobileControlDelete sScrollerID
end closeCard



on scrollerDidScroll hOffset, vOffset
   // When the user scrolls move the displayed content
   set the vScroll of group "scrollArea" to vOffset
end scrollerDidScroll

Re: Scroller bug!?

Posted: Tue May 14, 2013 11:12 am
by Dixie
see the attached stack...

Re: Scroller bug!?

Posted: Wed May 15, 2013 10:27 am
by DevBoyLars
Thank you :)

Re: Scroller bug!?

Posted: Wed May 15, 2013 10:22 pm
by DevBoyLars
Oh no :(

Now the text appears correctly, but if I switched from one card back to another, every scroller works just one time and stops then :(

What did I wrong?

I extended your code-sample to two cards, to show you what I mean (you need to start it in the iPhone-Simulator to see it)

Re: Scroller bug!?

Posted: Thu May 16, 2013 12:20 am
by Dixie
I know... :D
It is a problem that has not been sorted out when scrolling with fields... It does not seem to be a problem when scolling groups. Instead of deleting the scroller when you leave a card, just set its visibie to false then set it to true on your return...

I've modified the stack that I posted earlier in this post... two cards, both scrollers now work...
Dixie

Re: Scroller bug!?

Posted: Thu May 16, 2013 8:25 am
by DevBoyLars
PERFECT!!! Thanks much :)