App Programming‎ > ‎

Mobile Fields

Mobile Fields
Fields and objects on mobile platforms are implemented differently and require a little more work. You do not really have popup windows or multiple windows.

Scroller Fields

   put this on the CARD Script:

        local sScrollerID 
        
        on preOpenCard                                                                     //set up the scrolling field as you open the card
            local tScrollerRect,tContentRect                                         //
            if environment() is not "mobile" then exit preOpenCard     //exit if not on a mobile device
            mobileControlCreate "scroller", "myScroll"                         //create a scroller field
            put the result into sScrollerID                                             // and save the ID
            put the rect of fld "scrollme" into tScrollerRect 
            put the topleft of fld "scrollMe" & "," & the right of fld "scrollme"&","&( the top of fld "scrollme" + the formattedHeight of fld "scrollme") into tContentRect 
            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 preOpenCard

    on scrollerDidScroll hOffset, vOffset                                     // When the user scrolls move the displayed content 
            set the vScroll of fld "scrollMe" to vOffset 
    end scrollerDidScroll
Comments