Wish [B4X] CLVExpandable - Push the list up if expanded part is hidden.

MrKim

Well-Known Member
Licensed User
Longtime User
I love CLV with CLVExpandable, it is just so darn clean and professional but I have one minor nit to pick.

If the item you are expanding is toward the bottom of the display, or it is the last item, the expanded portion is hidden. If it is the last item you can't even tell it has been expanded except for the arrow flipping. So after expanding you have to manually drag the list up to see it.

It would be really nice if the list would "Push Up" when the expanded portion is off the screen.

Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Change the Expand code to:
B4X:
Public Sub ExpandItem (index As Int)
    ResizeItem(index, False)
    Dim item As CLVItem = mCLV.GetRawListItem(index)
    Dim delta As Int = item.Offset + item.Size - mCLV.sv.ScrollViewOffsetY - mCLV.AsView.Height
    If delta > 0 Then
        Sleep(5)
        Dim offset As Int = mCLV.sv.ScrollViewOffsetY + delta
        #if B4i
        Dim nsv As ScrollView = mCLV.sv
        nsv.ScrollTo(0, offset, True)
        #else if B4J 
        mCLV.sv.ScrollViewOffsetY = offset
        #Else If B4A
        Dim nsv As ScrollView = mCLV.sv
        nsv.ScrollPosition = offset
    #End If
    End If
End Sub
I've tested it in B4A only.
 

MrKim

Well-Known Member
Licensed User
Longtime User
Change the Expand code to:
B4X:
Public Sub ExpandItem (index As Int)
    ResizeItem(index, False)
    Dim item As CLVItem = mCLV.GetRawListItem(index)
    Dim delta As Int = item.Offset + item.Size - mCLV.sv.ScrollViewOffsetY - mCLV.AsView.Height
    If delta > 0 Then
        Sleep(5)
        Dim offset As Int = mCLV.sv.ScrollViewOffsetY + delta
        #if B4i
        Dim nsv As ScrollView = mCLV.sv
        nsv.ScrollTo(0, offset, True)
        #else if B4J
        mCLV.sv.ScrollViewOffsetY = offset
        #Else If B4A
        Dim nsv As ScrollView = mCLV.sv
        nsv.ScrollPosition = offset
    #End If
    End If
End Sub
I've tested it in B4A only.
Works Great in B4A,
B4J does NOT work in part because delta is a negative number which gets larger the farther away from the bottom you go.
I am working on testing B4i. I made a lot of changes that I need to clean up.
 

MrKim

Well-Known Member
Licensed User
Longtime User
Change the Expand code to:
B4X:
Public Sub ExpandItem (index As Int)
    ResizeItem(index, False)
    Dim item As CLVItem = mCLV.GetRawListItem(index)
    Dim delta As Int = item.Offset + item.Size - mCLV.sv.ScrollViewOffsetY - mCLV.AsView.Height
    If delta > 0 Then
        Sleep(5)
        Dim offset As Int = mCLV.sv.ScrollViewOffsetY + delta
        #if B4i
        Dim nsv As ScrollView = mCLV.sv
        nsv.ScrollTo(0, offset, True)
        #else if B4J
        mCLV.sv.ScrollViewOffsetY = offset
        #Else If B4A
        Dim nsv As ScrollView = mCLV.sv
        nsv.ScrollPosition = offset
    #End If
    End If
End Sub
I've tested it in B4A only.
OK, took a while, having strange issues installing B4i app. For some reason it gets to Loading... and then takes literally 10-15 minutes to load. Couldn't use debug mode.
Anyway, works just fine in B4i as well, So just doesn't work right in B4J.
 
Top