B4i Library [module] Fastscroll for scrollview

Here is my first contribution to the B4i community. It's a port of my B4a code module.

There are three examples two of which are examples that Erel posted with Fast scroll added.

TableFastScroll, adds a horizontal and vertical fast scroll bar to the Table.

CustomListViewFastScroll adds a vertical scroll bar to the custom listview

TableAsListViewFastScroll is a single column table acting as a list view. For large lists this is much quicker to load than customscrollview thanks to it's caching.

Porting was a breeze, even using UI objects. I've marked the amendments made so you can see how to add the fast scroll to a project.

The scroll button is an image view, so you can change it to whatever you please, it is currently just coloured with a border.

As usual, if you make improvements, please let us know and repost.

In Debug mode you can occasionally see the scrollview's panel while the list is scrolling if you make a large jump, this is almost imperceptible in release mode (at least on my Ipad mini 2).

It is actually 3 modules, GS is just a static globals module the contents of which you can move to your main module if you prefer.

I hope you find this useful.


  • CustomListViewFastScroll.zip
    7.9 KB · Views: 174
  • TableAsListViewFastScroll.zip
    8.8 KB · Views: 120
  • TableFastScroll.zip
    8.9 KB · Views: 130
Last edited:


Licensed User
Longtime User
Updated examples to fix a bug when y changes without x changing. Only the Table Module has changed.


Active Member
Licensed User
Longtime User
Hello, thank you for the examples! I have a very basic question as I am trying to learn. In the CustomListView code, in the CustomListView class your first line in the initialize sub is:

sv.Initialize("sv", Width, 0)

The first argument is the EventName, according to the doc it's:

EventName - Sets the subs that will handle the events.

Specifying "sv" as the value, I don't see how that maps to anything (i.e., there's no sub or function called "sv"). Does it map to the sv object, is it the prefix perhaps, so that events like "SV_ScrollChanged" would get triggered? I tried to read up on it but the doc is a bit light. I tried to look and see if the B4a doc had a little more info to see if it could help me understand it but didn't find anything.

I am sure it's something simple and forgive me for asking a very basic question. I like your example and would like to understand it more.

Thank You!


Licensed User
Longtime User
so that events like "SV_ScrollChanged"
Yes that's exactly it, The Customlistview Class is Erel's, but it set's the callback prefix for the sub in that module. So as you say SV_ScrollCchanged is called based on the EventName that is passed. My amendments pass that to FS.Manage_ScrollChanged so the fast scroll module can do it's stuff.


Licensed User
Longtime User
Kind of stupid question. How do I get the item (or index of the item) that was selected in your CurstomListView?

Using your example:

Sub clv2_itemclick(index As Int, value As Object)
Dim indice As Int
The following line causes a runtime error

hd.ToastMessageShow("Tocado " & NumberFormat(indice,3,0),False)
End Sub

Help would be appreciated


Licensed User
Longtime User
You don't need to call getItemFromView as the View is not returned, The selected index is returned as Index, the value stored at that index is returned as Value.