Hi there
This managed to search for a tree item using the text value and also select it, how can I get the treeview to scroll and show the item?
Thanks
B4X:
Sub TreeViewSetItem(tv As TreeView, s As String)
Dim ti As TreeItem
ti = TreeViewSearch(tv.Root, s)
If ti.IsInitialized = True Then
Dim jo As JavaObject = tv
jo.RunMethodJO("getSelectionModel", Null).RunMethod("select", Array(ti))
End If
End Sub
Sub TreeViewSearch(Parent As TreeItem, s As String) As TreeItem
For Each ti As TreeItem In Parent.Children
If ti.Text = s Then
Return ti
End If
If ti.Children.Size > 0 Then
Dim res As TreeItem = TreeViewSearch(ti, s)
If res.IsInitialized Then Return res
End If
Next
Dim res As TreeItem
Return res
End Sub
This managed to search for a tree item using the text value and also select it, how can I get the treeview to scroll and show the item?
Thanks