B4A Class IndexedTable

Erel

Administrator
Staff member
Licensed User
upload_2015-11-12_15-59-23.png

A ListView that allows the user to jump to a specific item based on the index.
It is implemented as a custom view. You need to add a CustomView in the designer and set its CustomType to IndexedTable.

Note that the items must be sorted.
It is similar to this B4i class: http://www.b4x.com/android/forum/threads/class-indexedtable.60280/
Its performance is better as it creates a map that maps between the characters and the relevant items (instead of searching all the items each time).
 

Attachments

Mahares

Well Known Member
Licensed User
On a small device the alphabetic index is very crowded as shown in this picture


I changed the pnIndex from a panel to a scrollview in the IndexedTable class so I can expand the spacing between the letters, but could not get the touch event of the scrollview to move the listview to the corresponding letter when touched as seen below.


Any hints on how to get the touch event to work on the scrollview and move the listview to the corresponding letter touched will be highly appreciated.

The problem seems to be in this sub. It does not apply to scrollview:
Private Sub pnlIndex_Touch(Action As Int, X As Float, Y As Float)
I have attched the project:

Thank you
 

Attachments

Last edited:

sorex

Expert
Licensed User
for some reason I can't view these images. I need to login but this doesn't work either (user '' does not exist)
 

Erel

Administrator
Staff member
Licensed User
You can add a panel to the ScrollView and then handle its Touch event.

A simpler approach can be to remove half of the characters (set their visible property to false). It will still be useful.
 

Croïd

Active Member
Licensed User
For initialize Table without designer. I must add panel too ?

B4X:
Table.initialize("","")
Table.net.initialize("Table.net")
 

Erel

Administrator
Staff member
Licensed User
What is Table.net?

You need to call Initialize and then DesignerCreateView with a panel (which will hold the list) and a label.
 

Anser

Well-Known Member
Licensed User
Is there a way to make the Visible property to False/True like any other views ?

EDIT : Solved as follows
B4X:
Dim Base As Panel = IndexedTable1.tv.Parent
Base.Visible = False
 
Last edited:
Top