I'd like to create a card with 3-4 text fields each having a native android scrollers. I followed the lesson here http://lessons.runrev.com/s/3527/m/4069 ... ll-a-field and managed to create such a field on 1 card. Then I tried to use the same code for another card with 3 fields that I grouped together and coded so that the group will have a native scroller. Each text field can be made visible by a separate button on that card.
It did not work out - the fields do not scroll.
The code is:
Code: Select all
local sScrollerID
on openCard
local tScrollerRect, tContentRect
// Only create a scroller on a mobile device
if environment() is not "mobile" then exit openCard
// Set the area of the scroller
put the rect of grp "abc" into tScrollerRect
// Set the area of the content to be scrolled
put 0,0,(the formattedWidth of grp "abc"),(the formattedHeight of grp "abc") into tContentRect
// Create the scroller control
mobileControlCreate "scroller", "myScroll"
put the result into sScrollerID
// Set the properties of the scroller
mobileControlSet "myScroll", "rect", tScrollerRect
mobileControlSet "myScroll", "contentRect", tContentRect
mobileControlSet "myScroll", "visible", true
mobileControlSet "myScroll", "scrollingEnabled", true
mobileControlSet "myScroll", "vIndicator", true
mobileControlSet "myScroll", "vscroll", 0
end openCard
on closeCard
// Delete the scroller
if environment() is not "mobile" then exit closeCard
set the vScroll of grp "abc" to 0
mobileControlDelete sScrollerID
end closeCard
on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of grp "abc" to vOffset
end scrollerDidScroll
stack is attached
keram