TableView test if scrolling is complete

Let’s say I have a table with a single column and 100 rows. I scroll/flick the table, it scrolls and it slows down and stops.  

How can I tell if it has fully stopped?  Is there an event I can attach to my tableview?

I can tell some movement with onRowRender and the tableview listener, but that isn’t telling me when the scrolling has fully stopped.

Any ideas/suggestions?

TableViews have a listener function that can detect the begin of scrolling, ended and when limits are hit. See the docs:

https://docs.coronalabs.com/api/library/widget/newTableView.html

Rob

Hi Rob,

I do have the “listener” defined and it’s using it.   The “ended” event is firing however the surface is still scrolling.  Try and flick a long list to see it fire the “ended” event and the surface will still scroll / finishing moving until gradually coming to a stop.   If I scroll to the top or bottom of the tableview I see the “event.limitReached” happening as expected.

I came up with a work-a-round for now.

-Paul

You’d have to modify it to do that, there isn’t an event for finshing the momentum scrolling. “ended” is the end of the touch.

You could grab the open source version of the widgets from https://github.com/coronalabs/framework-widget

if you were to add something along the lines of:

local newEvent =  {     target = view,     finishedScrolling = true } view.\_listener( newEvent)

at line 483 in widget_momentumScrolling.lua

then it’d call your listener with it when it stopped scrolling.

There have been improvements to the built in version of widget2 though that afaik haven’t made it to github yet so depending on how important it is you may be better off living with it as it is.

TableViews have a listener function that can detect the begin of scrolling, ended and when limits are hit. See the docs:

https://docs.coronalabs.com/api/library/widget/newTableView.html

Rob

Hi Rob,

I do have the “listener” defined and it’s using it.   The “ended” event is firing however the surface is still scrolling.  Try and flick a long list to see it fire the “ended” event and the surface will still scroll / finishing moving until gradually coming to a stop.   If I scroll to the top or bottom of the tableview I see the “event.limitReached” happening as expected.

I came up with a work-a-round for now.

-Paul

You’d have to modify it to do that, there isn’t an event for finshing the momentum scrolling. “ended” is the end of the touch.

You could grab the open source version of the widgets from https://github.com/coronalabs/framework-widget

if you were to add something along the lines of:

local newEvent =  {     target = view,     finishedScrolling = true } view.\_listener( newEvent)

at line 483 in widget_momentumScrolling.lua

then it’d call your listener with it when it stopped scrolling.

There have been improvements to the built in version of widget2 though that afaik haven’t made it to github yet so depending on how important it is you may be better off living with it as it is.