I am now using the xCustomListView and the class ExpandedListView, that states in the top of the code
'xCustomListView v1.65 - modified version to support expandable items
As we now have the version 1.73 of the xCustomListView, its all good., I think.
I am readjusting some code that I have inherited and need to get the full height of the contents of the expandable panels so I can resize them accordingly, after they are populated by their inner child views.
I have a ExpandedListView with several collapsable panels and each of them with several views, crated by the user dynamically. I need a method to recalculate the ExpandedHeight of that panel, so all inner items show when expanded. Any ideas?
I tried the approach below, and it works, but somebody may have a more efficient method.
I created a new property, AutoExpanded as a Boolean variable, and changed the default Expanded Sub.
Sub ExpandItem(index As Int)
Dim InnerReference As ExpandedListView = Me
Dim id As ItemData = InnerReference.GetValue(index)
If isAutoExpanded Then
Try
Dim cPanel As B4XView = InnerReference.GetPanel(index)
Dim TitlePanel As Panel = cPanel.GetView(0)
Dim ExpandablePanel As Panel = cPanel.GetView(1)
Dim AutoExpandableHeight As Int = 0
For x=0 To ExpandablePanel.NumberOfViews -1
AutoExpandableHeight = AutoExpandableHeight + ExpandablePanel.GetView(x).Height
Next
AutoExpandableHeight = AutoExpandableHeight + TitlePanel.Height
InnerReference.ResizeItem(index, AutoExpandableHeight)
Catch
InnerReference.ResizeItem(index, id.ExpandedHeight)
End Try
Else
InnerReference.ResizeItem(index, id.ExpandedHeight)
End If
InnerReference.GetPanel(index).Tag = True
If (mUpDownIconExists) Then
AnimatedArrow(index, 0, 180)
End If
End Sub