There's a glitch in my Android app that I can't figure out. I'm hoping a fellow forumite has some insight.
I have a card with a text field populated by a select call from a local mySQL database. If the text size exceeds the length of the text field, the card script resizes the field to the formattedHeight of the field. It also creates a mobile scroller. In iOS, the scroller works perfectly. In Android, the scroller loads properly. When the user scrolls down to the bottom of the text field, it still works. On leaving the card, the script deletes the scroller. It then recreates it on return to the page, with vScroll reset to 0. But when the user scrolls back up to the top, the top 2 lines of the text field are unviewable.
Here's the card script:
Code: Select all
on mouseUp
   
end mouseUp
on openCard
   setUpPassageScrolling
   hideNavBar
   set the visible of group "tabButtonRight" to false
end openCard
on closeCard
   if the environment is "mobile" then
   put mobileControls() into tMobileControls
      
         if tMobileControls contains "passageScroller" then
            mobileControlSet "passageScroller", "vScroll", "0"
      mobileControlDelete "passageScroller"
   end if
end if
end closeCard
on scrollerDidScroll hOffset, vOffset
      set the vScroll of group "passageGroup" of card "passage" to vOffset
end scrollerDidScroll
on setUpPassageScrolling
   
      set the vScroll of group "passageGroup" of card "passage" to 0
   set the vScroll of field "passageText" of card "passage" to 0
   
   if the environment is "mobile" then
         put mobileControls() into tMobileControls
      
         if tMobileControls contains "passageScroller" then
            mobileControlSet "passageScroller", "vScroll", "0"
      mobileControlDelete "passageScroller"
   end if
   end if
   
   set the height of field "passageText" of card "passage" to the formattedHeight of field "passageText" of card "passage"   
   set the top of field "passageText" of card "passage" to the top of group "passageGroup" of card "passage"
   
   if the formattedHeight of field "passageText" of card "passage" < the height of group "passageGroup" of card "passage" then
    set the vScrollbar of group "passageGroup" of card "passage" to false
   else
      
       if the platform is "iphone" then
          set the vScrollbar of group "passageGroup" of card "passage" to false
          mobileControlCreate "scroller", "passageScroller"
          put the rect of group "passageGroup" of card "passage" into tPassageGroupRect
          mobileControlSet "passageScroller", "rect", tPassageGroupRect
          put the rect of field "passageText" of card "passage" into tTextRect
          mobileControlSet "passageScroller", "contentRect", tTextRect
          mobileControlSet "passageScroller", "scrollingEnabled", true
          mobileControlSet "passageScroller", "opaque", true
          mobileControlSet "passageScroller", "vIndicator", true
          mobileControlSet "passageScroller", "canBounce", true
          mobileControlSet "passageScroller", "delayTouches", true
          mobileControlSet "passageScroller", "vScroll", "0"
          mobileControlSet "passageScroller", "visible", true
       else if the platform is "android" then
          set the vScrollbar of group "passageGroup" of card "passage" to false
          mobileControlCreate "scroller", "passageScroller"
          put the rect of group "passageGroup" of card "passage" into tPassageGroupRect
          mobileControlSet "passageScroller", "rect", tPassageGroupRect
          put the rect of field "passageText" of card "passage" into tTextRect
          mobileControlSet "passageScroller", "contentRect", tTextRect
          // mobileControlSet "passageScroller", "scrollingEnabled", true --commented out settings that follow don't work on Android
          mobileControlSet "passageScroller", "opaque", true
          mobileControlSet "passageScroller", "vIndicator", true
          // mobileControlSet "passageScroller", "canBounce", true
          // mobileControlSet "passageScroller", "delayTouches", true
          mobileControlSet "passageScroller", "vScroll", "0"
          mobileControlSet "passageScroller", "visible", true
       else
          set the layerMode of group "passageGroup" to "scrolling"
         set the vScrollbar of group "passageGroup" of card "passage" to true
         set the vScroll of group "passageGroup" of card "passage" to 0
         set the visible of group "passageGroup" of card "passage" to true
      end if
end if
   
end setUpPassageScrolling
Sean