is there a similar delayTouches code for Android?... or do I have to get innovative?... thanksmobileControlSet pName, "delayTouches", true
DelayTouches for Android?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 25
- Joined: Mon Feb 25, 2013 4:00 am
DelayTouches for Android?
I have a scrolling list field and added a native iOS type scroller to the field... It scrolls great, however, the list selection behavior is not ideal... when the user initiates scrolling it selects lines in the field... for multi select fields this is especially problematic because it highlights a whole string of lines... I am aware of the following iOS code to prevent such behavior...
Re: DelayTouches for Android?
Hello,
I am facing the exact same issue. How can I prevent a selection when i just want to scroll.
I am using the mobileControlSet scroller. I see, at least in the iOS simulator, that this is handled niceley there,
even without setting that property. On an android device the scrolling is interrupted by the touches that select and hilite lines in the list i am scrolling.
Is there any walkaround maybe by some extra code for that?
Thanks
I am facing the exact same issue. How can I prevent a selection when i just want to scroll.
I am using the mobileControlSet scroller. I see, at least in the iOS simulator, that this is handled niceley there,
even without setting that property. On an android device the scrolling is interrupted by the touches that select and hilite lines in the list i am scrolling.
Is there any walkaround maybe by some extra code for that?
Thanks
Re: DelayTouches for Android?
All Android scrolling fields will always briefly hilite the touched line before responding, so that part is normal. What I do is check in a scrollerDidScroll handler to see if the scroll has changed more than a few pixels (I usually use about one line height, but experiment.) If there's been enough movement, it's a scroll. If not, then it's a tap and I respond by calling the appropriate handler. I don't use mouseUp to determine taps in Android.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: DelayTouches for Android?
Thank you for the hints. I am having a try on your suggestions but
also having a hard time to find out how far the scroll did change.
Just ended up with the following lines:
But that does not work because the tDiff variable always ends up under the threshold.
I am not sure how to get that comparison of the change to work.How are you making that check ?
If I understand you right, a touch on the group and the inside List will always select and hilite the touched line. I really want to avoid that too.
I thought about disabling the autohilite property of the List at all and make the selection manually (when a tap is detected) depending on the actual mouse position. Is that somehow doable? Could i activate the autohilite for that moment and maybe send a fake touch start at that mouse position? maybe i am thinking too complicated?
I am quite new to LC and just starting to grasp the concepts, so sorry if that is a little stupid question
also having a hard time to find out how far the scroll did change.
Just ended up with the following lines:
Code: Select all
on scrollerDidScroll hOffset, vOffset
if vOffset > the vScroll of group "MyScrollGroup" then
put vOffset - the vScroll of group "MyScrollGroup" into tDiff
else
put the vScroll of group "MyScrollGroup" - vOffset into tDiff
end if
if tDiff > 20 then
set the vScroll of group "MyScrollGroup" to vOffset
else
put the selectedtext of fld MyList into fld SelectedLine
end if
end scrollerDidScroll
I am not sure how to get that comparison of the change to work.How are you making that check ?

If I understand you right, a touch on the group and the inside List will always select and hilite the touched line. I really want to avoid that too.
I thought about disabling the autohilite property of the List at all and make the selection manually (when a tap is detected) depending on the actual mouse position. Is that somehow doable? Could i activate the autohilite for that moment and maybe send a fake touch start at that mouse position? maybe i am thinking too complicated?
I am quite new to LC and just starting to grasp the concepts, so sorry if that is a little stupid question

Re: DelayTouches for Android?
Actually, here's an easier way:
What I meant when I said that hiliting was normal behavior is that the Android OS does that. If you run almost any Android app that allows a scrolling field to also accept taps, you'll see the line hilite briefly before it starts moving. The above code will do the same thing. However, I'd assumed you are using a native Android input field. The underlying LiveCode field should not have autohilite set at all, the input field handles that.
If you are using only a LiveCode field, things get trickier and scrolling won't be as smooth. You could toggle the autohilite property off on mouseDown but you'd still see a brief flash before it shuts off.
Code: Select all
local sStartPx
on mousedown
put the mouseV into sStartPx
end mousedown
on mouseUp
if abs(the mouseV - sStartPx) > 10 then pass mouseUp -- scrolling/dragging; adjust distance here
-- tap code here
end mouseUp
If you are using only a LiveCode field, things get trickier and scrolling won't be as smooth. You could toggle the autohilite property off on mouseDown but you'd still see a brief flash before it shuts off.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 44
- Joined: Wed Feb 13, 2013 3:38 pm
- Contact:
Re: DelayTouches for Android?
Just a thought - does setting the lockText property of the field to TRUE avoid the selection issue?
I'm just about to embark on making my iOS LC project Android-friendly - keen to know any such gotchas...
Kind regards, Paul.
I'm just about to embark on making my iOS LC project Android-friendly - keen to know any such gotchas...
Kind regards, Paul.
Re: DelayTouches for Android?
Thank you for the explanation and the snippet, that handling is very charming.
Have still much to learn.
It works very nice for my scrollers.
I will give the native android field a try also.
Have a nice day jacque
Have still much to learn.

It works very nice for my scrollers.
I will give the native android field a try also.
Have a nice day jacque
Re: DelayTouches for Android?
Actually I think the locktext has to be true regardless. If it isn't locked you can't scroll at all, you'll get the insertion point when you tap.PaulMaguire wrote:Just a thought - does setting the lockText property of the field to TRUE avoid the selection issue?
I'm just about to embark on making my iOS LC project Android-friendly - keen to know any such gotchas...
Kind regards, Paul.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 25
- Joined: Mon Feb 25, 2013 4:00 am
Re: DelayTouches for Android?
Thanks Jacque,
I actually had already applied a similar code to identify whether it was scrolling, tapping or nothing... on tap it saves the selections to a cProperty and then on ScrollerEndDrag (after scrolling stops and there is no action) it displays them.... this is in part where the problem lies.... for example, if i select the line 1 then scroll down 20 lines on ScrollerEndDrag it will re-highlight line 1 as desired.... in doing so it resets to the position where line 1 is visible in order to highlight it .... so if the user wanted highlight line 1 AND line 20 they would not be able to do it because on ScrollerEndDrag it would reset to make line 1 visible before the user would get to tap line 20....So, I'm assuming I can now hammer in some code that identifies the position of ScrollerEndDrag and then re-highlight line 1 and then reset the position to the position of ScrollerEndDrag .... however, I would assume that would look kinda glitchy as it jumps between orders very quickly.... hence the reason Im inquiring whether there is a DelayTouches equivalent for Android... but looks like this has to get coded in... any ideas to make this smooth?
I actually had already applied a similar code to identify whether it was scrolling, tapping or nothing... on tap it saves the selections to a cProperty and then on ScrollerEndDrag (after scrolling stops and there is no action) it displays them.... this is in part where the problem lies.... for example, if i select the line 1 then scroll down 20 lines on ScrollerEndDrag it will re-highlight line 1 as desired.... in doing so it resets to the position where line 1 is visible in order to highlight it .... so if the user wanted highlight line 1 AND line 20 they would not be able to do it because on ScrollerEndDrag it would reset to make line 1 visible before the user would get to tap line 20....So, I'm assuming I can now hammer in some code that identifies the position of ScrollerEndDrag and then re-highlight line 1 and then reset the position to the position of ScrollerEndDrag .... however, I would assume that would look kinda glitchy as it jumps between orders very quickly.... hence the reason Im inquiring whether there is a DelayTouches equivalent for Android... but looks like this has to get coded in... any ideas to make this smooth?
Re: DelayTouches for Android?
I think I see now. The problem is that selecting more than one line, on the desktop at least, requires that a control key of some type be depressed -- shift, command, control, etc. And of course on mobile you can't do that and Android doesn't have the equivalent of delaytouches.
I haven't needed to use a multi-select field yet, but the first thing I'd try would be to just lock the screen, set the (new) hilitedlines, reset the field scroll, and then unlock the screen. Visually nothing should move. If that's too tricky, you could try turning off autohilite on mousedown and then turning it back on in mouseup.
I haven't needed to use a multi-select field yet, but the first thing I'd try would be to just lock the screen, set the (new) hilitedlines, reset the field scroll, and then unlock the screen. Visually nothing should move. If that's too tricky, you could try turning off autohilite on mousedown and then turning it back on in mouseup.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 25
- Joined: Mon Feb 25, 2013 4:00 am
Re: DelayTouches for Android?
Your suggestions seem to work great... thanks