B4A Class IndexedTable

Discussion in 'Additional libraries, classes and official updates' started by Erel, Nov 12, 2015.

  1. Erel

    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).
     

    Attached Files:

    luke2012, Croïd, LucaMs and 15 others like this.
  2. Mahares

    Mahares Well Known Member Licensed User

    On a small device the alphabetic index is very crowded as shown in this picture
    [​IMG]

    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.
    [​IMG]

    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
     

    Attached Files:

    Last edited: Nov 27, 2015
  3. sorex

    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)
     
  4. Erel

    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.
     
    Mahares likes this.
  5. Croïd

    Croïd Active Member Licensed User

    For initialize Table without designer. I must add panel too ?

    Code:
    Table.initialize("","")
    Table.net.initialize(
    "Table.net")
     
  6. Erel

    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.
     
  7. Croïd

    Croïd Active Member Licensed User

    Sorry Erel

    Code:
    Table.tv
     
  8. Anser

    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
    Code:
    Dim Base As Panel = IndexedTable1.tv.Parent
    Base.Visible = 
    False
     
    Last edited: Oct 3, 2018
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice