B4J Question CustomListView Scrollbar Visibility

Discussion in 'B4J Questions' started by GuyBooth, Jun 16, 2019.

  1. GuyBooth

    GuyBooth Active Member Licensed User

    I have a CustomListView that sometimes only has two or three items in it and I don't want to show the scrollbar, and I want to widen the items to cover up the gap when the scrollbar isn't used. The gap disappears nicely if I uncheck the "Show Scroll Bar" property in the designer.
    Other times it has 20+ items and I want to use the scrollbar, so I want it checked.

    Is there a way to change the "Show Scroll Bar" property programmatically in B4J?
  2. Erel

    Erel Administrator Staff Member Licensed User

    Sub SetCLVScrollBars(clv As CustomListView, Visible As Boolean)
    Dim nsv As ScrollPane = clv.sv
    If Visible Then
    End If
    Dim jo As JavaObject = clv 'ignore
       jo.SetField("_scrollbarsvisible", Visible)
       clv.Base_Resize(clv.AsView.Width, clv.AsView.Height)
    End Sub
    GuyBooth and mangojack like this.
  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