B4A Library CustomListView - A flexible list based on ScrollView

Discussion in 'Additional libraries, classes and official updates' started by Erel, Jul 15, 2012.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    That's true. This is why it is good that an out of bounds error is raised when the developer tries to access an invalid panel.
     
  2. LucaMs

    LucaMs Expert Licensed User

    I think I've lost the thread, because it's exactly the message that you get:
    java.lang.IndexOutOfBoundsException: Invalid index 500, size is 5
    I would certainly have forgotten what my question was (two days for me are too many :D).
     
  3. LucaMs

    LucaMs Expert Licensed User

    About the divider line...

    I don't get dividers when I add my custom item. So I opened the example and it seems to me that you get the divider (second CLV) by placing the views not on top (layout).
    If you add a simple text item (AddTextItem) it seems that the dividerHeight is used.

    Is it so?


    [BTW in InsertAtTextItem there is a literal 2dip]
     
  4. LucaMs

    LucaMs Expert Licensed User

    No, it isn't. You voluntary placed the views not in top but not to get the divider.

    Anyway, I don't get it, creating the item in the same way you did.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread in the questions forum for the divider issue. Make sure to upload a project that demonstrates it (and uses the unmodified CustomListView class).
     
    LucaMs likes this.
  6. Erel

    Erel Administrator Staff Member Licensed User

    V1.76 was released. See first post for more information.
     
    lemonisdead likes this.
  7. LucaMs

    LucaMs Expert Licensed User

    It seems to me that there is a bug.

    To demonstate it, I'm attaching a small project (sizes are set for my tablet, in portrait mode, sorry :)).

    On Activity creation, I add 2 items; then, in the Button1 click event, I remove them and add 2 new items (identical).
    Clickng several times you will see that the position of the new second item will be wrong.


    P.S. Replaced the CLV with the new and original version 1.76 (same bug).
     

    Attached Files:

    Last edited: Aug 30, 2017
    Star-Dust likes this.
  8. Erel

    Erel Administrator Staff Member Licensed User

    Note that you don't need this designer script line:
    Code:
    CustomListView1.SetTopAndBottom(0, Button1.Top - 4dip)
    Just set the vertical anchors to BOTH.

    The issue is fixed for the next update. It happens when you call RemoveAt and remove the last item. Change RemoveAt code to:
    Code:
    Public Sub RemoveAt(Index As Int)
       
    If GetSize <= 1 Then
         Clear
         
    Return
       
    End If
       
    Dim removePanel, p As Panel
       removePanel = panels.Get(Index)
       
    For i = Index + 1 To items.Size - 1
         p = panels.Get(i)
         p.Tag = i - 
    1
         
    Dim NewTop As Int = p.Top - heights.Get(Index) - dividerHeight
         p.top = NewTop
       
    Next
       sv.Panel.Height = sv.Panel.Height - heights.Get(Index) - dividerHeight
       items.RemoveAt(Index)
       panels.RemoveAt(Index)
       heights.RemoveAt(Index)
       removePanel.RemoveView
    End Sub
     
    LucaMs likes this.
  9. ThePuiu

    ThePuiu Active Member Licensed User

    Is it possible to identify a specific panel based on his own tag?
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    Everything is possible. Please start a new thread in the questions forum.
     
  11. LucaMs

    LucaMs Expert Licensed User

    Can these be useful?

    Code:
    Public Sub GetItemFromValue(Value As Object) As Int
        
    Return items.IndexOf(Value)
    End Sub

    Public Sub GetPanelFromValue(Value As Object) As Panel
        
    Dim pnl As Panel
        
    Dim idx As Int = items.IndexOf(Value)
        
    If idx > - 1 Then
            pnl = panels.Get(idx)
        
    End If
        
    Return pnl
    End Sub
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    If they are useful for you then add them.

    1. You assume that all values are unique. This may not be the case.
    2. CustomListView will not be updated any more. It is replaced with xCustomListView.
     
  13. LucaMs

    LucaMs Expert Licensed User

    Are you sure? :D

    Yes, but there may be some cases (user rankings).
    Otherwise, the method (or a v.2) could return a list of panels.

    I had forgotten to have read this "new CLV"; I will add these posts to that thread (I'm kidding :)).
     
  14. sseaand

    sseaand Member Licensed User

    How to disable ItemClick event from this panel?
     

    Attached Files:

  15. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question.
     
  16. trueboss323

    trueboss323 Active Member Licensed User

    How can i add group headers in the list view?
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question.
     
  18. Erel

    Erel Administrator Staff Member Licensed User

Thread Status:
Not open for further replies.
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