Stop a scroller in motion

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
grimaldiface
Posts: 43
Joined: Tue Apr 08, 2008 9:56 pm

Stop a scroller in motion

Post by grimaldiface » Tue Jan 06, 2015 5:20 am

I am creating an app that is very similar to the "Contacts" app-- there is a bunch of alphabetic content that the user can scroll through. On the right is the alphabet listed--which allows the user to quickly jump to any part of the scroller (see screen shot). Currently, it works by detecting a movement over the alphabet--then it finds the proper vscroll and sets the vscroll of the scroller. The problem I'm having is that if the user flicks the scroller, then starts using the alphabet thingy, the two "compete" for setting the vscroll. It's a jerky mess. Is there a command that will stop a scroller that is already in motion?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Stop a scroller in motion

Post by Dixie » Tue Jan 06, 2015 10:12 am

Ciuld you perhaps use the 'dragging' property of the scroller to determine if a scroll (drag action) is already taking place and if it is then don't allow another scroll ( drag action) to take place until the first one has finished... Since the 'dragging' property for the scroller is boolean, if should be fairly simple to determine...

grimaldiface
Posts: 43
Joined: Tue Apr 08, 2008 9:56 pm

Re: Stop a scroller in motion

Post by grimaldiface » Wed Jan 07, 2015 2:07 am

Dixie wrote:Ciuld you perhaps use the 'dragging' property of the scroller to determine if a scroll (drag action) is already taking place and if it is then don't allow another scroll ( drag action) to take place until the first one has finished... Since the 'dragging' property for the scroller is boolean, if should be fairly simple to determine...
well, there really aren't "two" scroll actions. I'm just trying to terminate a scroll in progress. Imagine a scroller with a large amount of content. You give it a quick flip and watch it fly. It will eventually slow down and come to a stop, but I want to manually stop it. Like press a button and the scroller stops moving (similar to if you were to just put your finger down on it while it was in motion).

grimaldiface
Posts: 43
Joined: Tue Apr 08, 2008 9:56 pm

Re: Stop a scroller in motion

Post by grimaldiface » Sat Jan 10, 2015 11:00 pm

Still searching for an answer to this. Anybody?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Stop a scroller in motion

Post by Simon » Sun Jan 11, 2015 4:18 am

This;

Code: Select all

on scrollerDidScroll hOffset, vOffset
   if goodToGo then
      set the vScroll of group "scrollArea" to vOffset
   end if
end scrollerDidScroll
Putting false into goodToGo stops it dead.
Sorry only tested on Android.

Simon
Scroller Example.zip
(3.39 KiB) Downloaded 242 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Stop a scroller in motion

Post by jacque » Sun Jan 11, 2015 9:15 pm

I haven't tried it, but see if you can trap either the scrollerEndDecelerate or the scrollerEndDrag message. One of those might tell you when the user stops the scroller.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

grimaldiface
Posts: 43
Joined: Tue Apr 08, 2008 9:56 pm

Re: Stop a scroller in motion

Post by grimaldiface » Mon Jan 12, 2015 1:40 am

Simon wrote:This;

Code: Select all

on scrollerDidScroll hOffset, vOffset
   if goodToGo then
      set the vScroll of group "scrollArea" to vOffset
   end if
end scrollerDidScroll
Putting false into goodToGo stops it dead.
Sorry only tested on Android.

Simon
Scroller Example.zip
This works pretty well, in that it stops the content from moving. The downside is that the native scroller still maintains it's momentum regardless. If I set gGoodToGo to false, it stops the content from scrolling. However, if gGoodToGo is set back to true while the nativeScroller is still decelerating, then the content will start moving again. However, this is getting closer to exactly what I want, so thanks!

Ideally there should be a mobileControlSet "stopmovingyoustupidscroller" to send to the native scroller.

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: Stop a scroller in motion

Post by keram » Wed Jan 21, 2015 5:16 pm

Hi Simon,

Just came across your post with the sample stack and tested it on my Android tablet.
When scrolling down it does not go all to the bottom of the text (see the screen shot) - there are still many lines below the bottom edge.
Any idea why?

keram
Attachments
Screenshot_2015-01-21-21-34-03.png
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Stop a scroller in motion

Post by Simon » Thu Jan 22, 2015 1:15 am

Hi keram,
That field is locked, just unlock it and reset it's height.
Note... The field not the group :)

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply