I made a card with a field that is scrolling and showing the fonts on android device. Then I added another card with a group to select the color of the text and background. I used the same script for scrolling the group as the script for scrolling the field on the first card. But the group for colors selection does not scroll on android.
The code for scrolling the fonts field is on the card level:
Code: Select all
on openCard
local tScrollerRect, tContentRect, sScrollerID
// Only create a scroller on a mobile device
if environment() is not "mobile" then
set vScrollbar of fld "allfonts" to true
exit openCard
else
set vScrollbar of fld "allfonts" to false
end if
// Set the area of the scroller
put the rect of fld "allfonts" into tScrollerRect
// Set the area of the content to be scrolled
put 0,0,(the formattedWidth of fld "allfonts"),(the formattedHeight of fld "allfonts") 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 fld "allfonts" to 0
mobileControlDelete sScrollerID
end closeCard
on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of fld "allfonts" to vOffset
end scrollerDidScroll
--on mouseUp
-- hide fld "allfonts"
--end mouseUp
Code: Select all
on openCard
local tScrollerRect, tContentRect, sScrollerID
if the platform is "android" then
set the vScrollbar of grp "colorList" to false
else
set the vScrollbar of grp "colorList" to true
end if
// Only create a scroller on a mobile device
if environment() is not "mobile" then
set vScrollbar of grp "colorList" to true
exit openCard
else
set vScrollbar of grp "colorList" to false
end if
// Set the area of the scroller
put the rect of grp "colorList" into tScrollerRect
// Set the area of the content to be scrolled
put 0,0,(the formattedWidth of grp "colorList"),(the formattedHeight of grp "colorList") 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 "colorList" to 0
mobileControlDelete sScrollerID
end closeCard
on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of grp "colorList" to vOffset
end scrollerDidScroll
These two scripts are identical with the only difference of having fld "allfonts" in the first one and grp "colorList" in the second.
Why is the color group not scrolling?
I'm attaching the stack.
keram