Mouse messages in scrollers

scott at elementarysoftware.com scott at elementarysoftware.com
Tue May 19 18:20:21 EDT 2020


I’m using this script on iOS directly inside a LC field object in order to get a "delete button” to appear. (Ya, I know that is pretty ancient UI) But it requires a swipe on iOS which is what you are after. I don’t think it is responsive enough to do some of the fancy pushes that differentiate between showing and sending things. It has been a long time since I worked on this (and I chopped out a lot of code) so it is possible that I’ve missed something. FYI: the field is a “List” field.


-- I use these values for swiping
put 40 into gHorizontalSwipeDistance
put 15 into gVerticalSwipeDistance

-- I'm assuming the list behavior of the field needs to be true
-- field script

on touchStart pID
   put the mouseV into lMouseStartV
   put the mouseH into lMouseStartH
   -- some actions night need to go here
end touchStart	
  
   
on touchMove pTouchID, pTouchH, pTouchV 
   -- see if there was a swipe for delete
   if ((abs(pTouchH - lMouseStartH) > gHorizontalSwipeDistance)) AND\
   (abs(pTouchV - lMouseStartV) < gVerticalSwipeDistance) then
      -- they swiped
      --  unhilite the line
      set the hilitedLine of fld "ScrollingList" of cd "ListOfLists" to empty
     -- do stuff here
end touchMove


on touchRelease pID
   -- unhilite the line
   set the hilitedLine of fld "ScrollingList" of cd "ListOfLists" to empty
end touchRelease

—
Scott Morrow

Elementary Software
(Now with 20% less chalk dust!)
web       https://elementarysoftware.com/
email     scott at elementarysoftware.com
booth    1-800-615-0867
------------------------------------------------------


> On May 19, 2020, at 2:21 PM, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I have a tall field inside a shorter group that uses a mobile scroller. A behavior assigned to the group handles the scrolling and checks for swipes by capturing mouseDown and mouseUp to determine touch locations so it can calculate the direction of the swipe. This works on Android.
> 
> On iOS I do not get mouseUp or mouseDown messages when swiping horizontally, though I do get scrolerDidScroll when swiping vertically. But since the group is exactly as wide as the field it encloses, it does not scroll horizontally and so no scrollerDidScroll message is sent. I also do not get scrollerBegin/EndDrag, touchStart or touchEnd, or any other message I can think of to track a horizontal swipe. I do get mouseUp/Down when tapping on the scroller but that doesn't help here.
> 
> How would I detect a horizontal swipe on a non-moving scroller? The user can't navigate without it.
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> 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