Android Scrolling Field - 9.6.dp1 - Receives MouseUp/Down
J. Landman Gay
jacque at hyperactivesw.com
Tue Dec 10 16:05:13 EST 2019
I think you're seeing this bug, which was fixed in 9.0.5:
<https://quality.livecode.com/show_bug.cgi?id=12419>
Without a mouseUp message, it is impossible to detect a swipe within a
scroller, which was another fundamental issue that has been corrected.
Users depend on swipes, and on mobile it couldn't be done. Taps worked,
but all user gestures were detected as a tap instead of a swipe. It was
finally fixed.
Here is what I use to detect taps and swipes on a native scroller:
******
-- behavior script, assigned to all scrolling controls:
local sMouseLoc,sStartLoc
on mouseDown
put the mouseloc into sMouseLoc
put sMouseLoc into sStartLoc
end mouseDown
on mouseUp
put "" into sMouseLoc
if abs(the mouseH - item 1 of sStartLoc) <= 10 and \
abs(the mouseV - item 2 of sStartLoc) <= 10 then
send "doScrollerTap" to the target
else if isSwipe(sStartLoc) then
doSwipe sStartLoc -- navigate
end if
end mouseup
on mouseMove x,y -- desktop scrolling, you can omit this if you don't
need it
if isMobile() or sMouseLoc = "" then exit mouseMove
put abs(x - item 1 of sMouseLoc) into tHDist
put abs(y - item 2 of sMouseLoc) into tVDist
if item 2 of sMouseLoc > y then -- pushing up
if the name of me contains "image" then set the hscroll of me to
the hscroll of me + tHDist -- bgImg okay
set the vscroll of me to the vscroll of me + tVDist
else if item 2 of sMouseLoc < y then -- pushing down
if the name of me contains "image" then set the hscroll of me to
the hscroll of me - tHDist
set the vscroll of me to the vscroll of me - tVDist
end if
put x,y into sMouseLoc
end mouseMove
on mouseRelease
put "" into sMouseLoc
put "" into sStartLoc
end mouseRelease
********
This requires that a "doScrollerTap" handler is in the message path if
you want to detect taps. Or you could send a different message.
Here is the handler that detects swipes:
******
function isSwipe pStartLoc -- calculate if a gesture is a horizontal swipe
-- called from scrollerBehavior
-- pStartLoc = initial mouseloc at mouseDown
put abs(the mouseH - item 1 of pStartLoc) into tHDist
put abs(the mouseV - item 2 of pStartLoc) into tVDist
return tHDist > tVDist -- swipe
end isSwipe
******
On iOS you could also try playing with canCancelTouches and delayTouches
to see if that helps. Android doesn't support those though. I did set
both to false in one case and it seemed to help when used with the above
handlers.
On 12/10/19 12:02 PM, Lagi Pittas via use-livecode wrote:
> Hi All
>
> I haven't seen anyone else mention this problem or even get involved in a
> discussion here except for Bob to confirm it.
> It is a FUNDAMENTAL problem.
>
> @Jacque since you deploy (if memory serves) large android apps , can you
> confirm the error and @Panos is there a
> workaround or a fix coming anytime soon?
>
> For IOS 13 we have to use the latest and it is a real pain to work out when
> the Android scroller went wrong within the
> V 9 series. - never mind having to have multiple environments to compile
> with.
>
> This is a SHOWSTOPPER we have been mostly testing the IOS apps that work
> and all of the Android stuff worked
> if we didn't have a "long" list that needed to scroll and select. Only
> noticed with "Real" data with a long list.
>
> Gone back to 9.5 and the problem is still there.
>
> will try 9.05 and see what happens.
>
> Looks from our testing that the ScrollerBeginDrag and ScrollerEndDrag are
> not being fired.
> Regards Lagi
>
>
>
> On Fri, 6 Dec 2019 at 14:51, Sannyasin Brahmanathaswami via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
>> On 9.6 dp 1 I was testing on iOS for a week.
>>
>> Then I tested on Android. Surprising new behavior in the mobileScroller:
>>
>> It receives the mouseDown as soon as you scroll, or mouseUp after you
>> scroll. This does not happen on iOS, not did in happen in 9.5 on Android.
>>
>> How can I prevent this and only trigger a "touch" when the user is not
>> scrolling?
>>
>> 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
>>
> _______________________________________________
> 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
>
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list