B4A Class IndexedTable

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: https://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

  • IndexedTable.zip
    11.3 KB · Views: 603

Mahares

Expert
Licensed User
Longtime 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

  • IndexedTable_With_Index_In_Scrollview.zip
    16.3 KB · Views: 384
Last edited:

sorex

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

Croïd

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

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

Anser

Well-Known Member
Licensed User
Longtime 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