Sub ScrollToItem (tree As TreeView, ti As TreeItem)
Dim p As TreeItem = ti.Parent
Do While p.Root = False
p.Expanded = True
p = p.Parent
Loop
Dim index As Int = CountVisibleChildren(tree.Root, ti, Array As Boolean(False))
Dim jo As JavaObject = tree
Log(index)
jo.RunMethod("scrollTo", Array(index))
End Sub
Sub CountVisibleChildren(ti As TreeItem, Target As TreeItem, Found() As Boolean) As Int
Dim c As Int = 1
If ti = Target Then
Found(0) = True
Return -1
End If
If ti.Expanded Then
For Each child As TreeItem In ti.Children
c = c + CountVisibleChildren(child, Target, Found)
If Found(0) = True Then Return c
Next...