Emulate thumb drag on desktop

Brahmanathaswami brahma at hindu.org
Sun Aug 9 01:04:17 CEST 2015


To scroll a field on mobile I'm going to try this:

on createQuoteScroller
    local tScrollerRect,tContentRect,sScrollerID
    if environment() is not "mobile" then exit createQuoteScroller
    mobileControlCreate "scroller", "quoteScroller"
    put the result into sScrollerID
    put the rect of fld "quote" 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 "quoteScroller", "rect", tScrollerRect
    mobileControlSet "quoteScroller", "contentRect", tContentRect
    mobileControlSet "quoteScroller", "visible", true
    mobileControlSet "quoteScroller", "scrollingEnabled", true
    mobileControlSet "quoteScroller", "vIndicator", true
    mobileControlSet "quoteScroller", "vscroll", 0
end createQuoteScroller

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

but how do we emulate this with the mouse?

on mouseMove

end mouseMove

would seem to be our best tool

but how to translate the mouseloc into vScroll of the field?

on mouseMove
    put the mouseloc
end mouseMove

have to sleep on that one... but perhaps someone else already build this...

BR



More information about the use-livecode mailing list