B4J Question TreeItem Request Focus

TorontoJim

Member
Licensed User
Longtime User
Is there a Java method that will set the focus of a tree item? There is no RequestFocus for TreeItems.
 

eurojam

Well-Known Member
Licensed User
Longtime User
I use this one, which loops trough the items and compare it to the item which I want to select (Code comes from Erel, but I don't have the link anymore...):
B4X:
    Dim l As List
    l = ItinTV.Root.Children

    For i = 0 To l.Size-1
        Dim TreeItem1 As TreeItem
        TreeItem1 = l.Get(i)
        If TreeItem1.Text = s Then  'compare the items
            Dim jo As JavaObject = ItinTV
            jo.RunMethodJO("getSelectionModel", Null).RunMethod("select", Array(TreeItem1))
            Return
        End If
    
    Next
 
Upvote 0
Top