This is useful to lazy load a listview, as customlistview costs more memory. This is the reference webpage: https://www.superglobals.net/javafx-listview-lazy-loading/
B4X:
Sub addScrollChangedEvent
Dim jo As JavaObject
jo=ListView1
Dim nodes() As Object
nodes=jo.RunMethodJO("lookupAll",Array(".scroll-bar")).RunMethod("toArray",Null)
Dim ListViewScrollBar As JavaObject
For Each sb As Object In nodes
Dim sbJO As JavaObject
sbJO=sb
Dim orientation As String=sbJO.RunMethod("getOrientation",Null)
If orientation="VERTICAL" Then
ListViewScrollBar=sbJO
End If
Next
Log(ListViewScrollBar)
Dim r As Reflector
r.Target=ListViewScrollBar
r.AddChangeListener("ListView1_ScrollPosition","valueProperty")
End Sub
Sub ListView1_ScrollPosition_Changed(OldVal As Object,NewVal As Object)
Log(OldVal)
Log(NewVal)
End Sub
Last edited: