Scrollview with Tableview-like culling?

I seem to remember someone posting that they had modified the open-source Scrollview code to cull off-screen stuff like the tableView widget does. I can’t find the thread however, I was wondering if that was code available anywhere or if someone else has done something similar?

I basically use scrollViews like tableViews but have my own library for drawing rows that I don’t really want to mess with, it would be a big switch to change 20+ scrollviews across. However once you get a scrollView with 50+ rows it really starts to lag.  :o

It was me and I turned the scrollView into a two row multi column implementation.  Basically I add and/or cull objects when the objects bounds go of screen by using an enterFrame() listener.  The modification to the widget is actually really simple and you just need to remove this line (in widget_scollview.lua) self:scrollToPosition( { x = origX, y = origY, time = 0 } ) to allow the custom functionality to work.

Your scrollView will then support thousands of object just like tableView does.

Thanks for this, I finally got round to updating my row pooling code to send off-screen rows back to the pool and grab them when a new row is on screen. Works like a charm :slight_smile:

One thing to add is to make sure the first and last rows are always drawn and never culled to keep the overall height of the view consistent.

It was me and I turned the scrollView into a two row multi column implementation.  Basically I add and/or cull objects when the objects bounds go of screen by using an enterFrame() listener.  The modification to the widget is actually really simple and you just need to remove this line (in widget_scollview.lua) self:scrollToPosition( { x = origX, y = origY, time = 0 } ) to allow the custom functionality to work.

Your scrollView will then support thousands of object just like tableView does.

Thanks for this, I finally got round to updating my row pooling code to send off-screen rows back to the pool and grab them when a new row is on screen. Works like a charm :slight_smile:

One thing to add is to make sure the first and last rows are always drawn and never culled to keep the overall height of the view consistent.