B4i Library [class] IndexedTable

Discussion in 'iOS Libraries' started by Erel, Nov 12, 2015.

  1. Erel

    Erel Administrator Staff Member Licensed User

    This class adds an "index" to a TableView:



    B4A implementation of this class: http://www.b4x.com/android/forum/threads/indexedtable.60300/

    Note that the B4A implementation uses a Map as a small index. This improves the performance if there are many items. It should be simple to port it to this implementation.
     

    Attached Files:

    Last edited: Nov 12, 2015
    luke2012, narek adonts and MikeH like this.
  2. sorex

    sorex Expert Licensed User

    nice, Erel.

    I just wondered what would happen if you add 1 more character in that list?
     
  3. John Woodsmall

    John Woodsmall Active Member Licensed User

    ok..got this work...great
    But...
    can i add to the text file and then at a later date
    delete from the text file.
    i mean to have a list of birth dates that are added programmaticly
    I would want to access them and maybe delete one or two later.
    Like a text database.

    can i do this with this nice new text index?
    (i do all of this now with an oracle database on-line)
    but i would like to have a local database on the phone.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You can add characters. Go over the code and see how it handled the characters.

    Not sure that I understand the question. It is better to post it in another thread.
     
  5. Mahares

    Mahares Well Known Member Licensed User

    This post should have been for B4A not B4i. Please move to B4A
    On a small device the alphabetic index is very crowded as shown in this picture
    upload_2015-11-26_9-35-58.png
    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 as seen below.
    upload_2015-11-26_9-42-56.png

    Any hints on how to get the touch event to work and move the listview to the corresponding letter touched will be highly appreciated.
    Thank you
     
    Last edited: Nov 26, 2015
  6. Erel

    Erel Administrator Staff Member Licensed User

    It is not possible to move the post. Please start a new thread for this in the questions forum.
     
  7. RVP

    RVP Active Member Licensed User

    Indexed Table is based on TableView which you added support to for Action Buttons. However it is not possible to pass the ActionButtonClicked event back to the main program as it has 3 parameters and there is no CallSub4 option.

    For now I have done it like this:

    Code:
    Private Sub tv_ActionButtonClicked (SectionIndex As Int, Cell As TableCell,text As String' added Custom RVP
        Dim calllist As List
        calllist.Initialize
        calllist.Add(Cell)
        calllist.Add(text)
        
    CallSub3(mTarget, mEventName & "_ActionButtonClicked", SectionIndex, calllist)
    End Sub
    But it would be nice to have it using the actual parameters
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Use CallSub2 and put the parameters in an array:
    Code:
    CallSub2(..., ..., Array (SectionIndex, Cell, Text))

    Sub tt_ActionButtonClicked (Params() As Object)
     
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