Emulate thumb drag on desktop
Mike Bonner
bonnmike at gmail.com
Sat Aug 8 19:14:30 EDT 2015
To do it with this method, the traversal of the field needs to be off.
(though this can probably be worked around)
Put this script into the field.
local sMouseLoc
on mouseDown
put the mouseloc into sMouseLoc
setScroll
end mouseDown
on setScroll
if the mouse is down then
lock screen
if item 1 of sMouseLoc > item 1 of the mouseloc then
set the hscroll of me to the hscroll of me - (item 1 of the
mouseloc - item 1 of sMouseLoc)
else
set the hscroll of me to the hscroll of me + (item 1 of sMouseLoc
- item 1 of the mouseloc)
end if
if item 2 of sMouseLoc > item 2 of the mouseloc then
set the vscroll of me to the vscroll of me - (item 2 of the
mouseloc - item 2 of sMouseLoc)
else
set the vscroll of me to the vscroll of me + (item 2 of sMouseLoc
- item 2 of the mouseloc)
end if
put the mouseloc into sMouseLoc
send setScroll to me in 50 millisec
unlock screen
else
put empty into sMouseLoc
end if
end setScroll
On Sat, Aug 8, 2015 at 5:04 PM, Brahmanathaswami <brahma at hindu.org> wrote:
> 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
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list