B4J Question AutoShowScrollbar in CustomListView

aeric

Expert
Licensed User
Longtime User
By default, we need to set the property in designer. There is a ShowScrollBar property in PCLV.
I want to know is there any way that I can make my horizontal CLV hide the scrollbar when all the items are displayed and only show the scrollbar when the CLV is scrollable?
 

PaulMeuris

Well-Known Member
Licensed User
1734078334188.png

You can switch off the Show Scroll Bar property of the CLV.
In the fill_clv1 subroutine you can add the lines 13 and 14.
You can change the line 5 to test.
I have used some code from my CLV_examples tutorial (page 16).
B4X:
Private Sub fill_clv1
    clv1.Clear
    Dim fnames As List = get_filenames
    Dim itemlst As List = get_titleitems
    For i = 0 To 1        'itemlst.Size -1
        Dim item As String = itemlst.Get(i)
        Dim fname As String = fnames.Get(i)
        Dim note As String = notesmap.Get(item)
        Dim pn As Pane = set_clv1_item(i,fname,item,note)
        clv1.Add(pn,itemlst.Get(i))
        Hdragger.AddDragButtons
    Next
    Dim sv As ScrollPane = clv1.sv
    sv.SetHScrollVisibility("AS_NEEDED")
End Sub
The CLV uses an internal Scrollpane...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
View attachment 159467
You can switch off the Show Scroll Bar property of the CLV.
In the fill_clv1 subroutine you can add the lines 13 and 14.
You can change the line 5 to test.
I have used some code from my CLV_examples tutorial (page 16).
B4X:
Private Sub fill_clv1
    clv1.Clear
    Dim fnames As List = get_filenames
    Dim itemlst As List = get_titleitems
    For i = 0 To 1        'itemlst.Size -1
        Dim item As String = itemlst.Get(i)
        Dim fname As String = fnames.Get(i)
        Dim note As String = notesmap.Get(item)
        Dim pn As Pane = set_clv1_item(i,fname,item,note)
        clv1.Add(pn,itemlst.Get(i))
        Hdragger.AddDragButtons
    Next
    Dim sv As ScrollPane = clv1.sv
    sv.SetHScrollVisibility("AS_NEEDED")
End Sub
The CLV uses an internal Scrollpane...
This works but I need to set the correct height so the clv is not vertically scrollable.
Any idea how I can set the height?
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
My 2 cents.
Note that the project inside the zip has the same name as your.
So watch out not to overwrite.
 

Attachments

  • AutoShowScrollbar2.zip
    4.5 KB · Views: 8
Upvote 0
Top