To initially get started with creating a scroller I downloaded a tutorial that works just great - except that it I can't seem to change the position of the field and scroll area without the scroller refusing to display the first few lines of the text.
"Out of the box", the example has the text field positioned in the upper left hand corner of the screen. I have tried numerous ways to move it down and toward the center, as would be a more typical situation. When it first displays, the top of the text within the field is visible, but as soon as the scroller is activated, it will scroll down and back up again, but now clipping the first few lines.
I've been testing this on the Android simulator and a device, but I thought that this is a more general question than for just the Android forum.
Here is the code, cut and pasted from the example. The only thing I change is the position of the text field and the scroll area object when I run into trouble.
Thanks in advance for any advice.
Code: Select all
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 "lorem",the top of field "lorem",the right of field "lorem",the formattedHeight of field "lorem" into tContentRect
   
   // Create the scroller control
   mobileControlCreate "scroller", "loremScroll"
   put the result into sScrollerID
   
   // Set the properties of the scroller
   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
   // 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
