Swipe gestures on a mobile scroller
paul at livecode.org
Sun Nov 20 00:48:20 CET 2016
> On Nov 19, 2016, at 11:38 AM, J. Landman Gay <jacque at hyperactivesw.com> wrote:
> Anyone have a workaround?
Kind of! I built an iOS app that needed to display some long fields of text, I built some pages based around this lesson:
I had the same problem with navigating cards using swipe gestures because the field covered the majority of the card, I managed to work around the problem by modifying the scrollerDidScroll handler to:
on scrollerDidScroll hOffset, vOffset
// When the user scrolls horizontally, navigate in the desired direction
if the hScroll of group "scrollArea" <0 then // Detect the horizontal swipe
moveBack // Stack handler to move back to Index card
else if the hScroll of group "scrollArea" >0 then
moveForward // Stack handler to move to next card
// When the user swipes vertically, scroll the displayed content
set the vScroll of group "scrollArea" to vOffset
To make this work I had to set these properties on the text field;
lock text “true”
So this may not work if you need the user to be able to modify the text unless you can give them a method of changing between edit/navigate modes.
I’ve managed to update the lesson file, it's on dropbox, so if it helps here it is for you to test:
It does seem to be reasonably reliable, but not if you tend to swipe too fast, I have’t tried it on Android though.
More information about the use-livecode