Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private Button1 As B4XView
Private TreeTableView1 As TreeTableView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
Dim parent As TreeTableItem = TreeTableView1.Root
TreeTableView1.SetColumnSortable(0, False)
TreeTableView1.SetColumnSortable(1, False)
For i = 1 To 10
Dim t As TreeTableItem
t.Initialize("", Array(Rnd(1, 100), Rnd(1, 100), Rnd(1, 100)))
parent.Children.Add(t)
Next
Dim r As Reflector 'jReflection library
r.Target = TreeTableView1
r.AddEventFilter("TreeTableView", "javafx.scene.input.MouseEvent.MOUSE_CLICKED")
End Sub
Sub TreeTableView_Filter(e As Event)
Dim jo As JavaObject = e
Dim target As B4XView = jo.RunMethod("getTarget", Null)
Do While target.IsInitialized
If GetType(target) = "javafx.scene.control.skin.TableColumnHeader" Then
jo = target
Dim children As List = jo.RunMethod("getChildrenUnmodifiable", Null)
For Each c As B4XView In children
If c Is Label Then
TreeHeaderClicked(c.Text)
End If
Next
e.Consume
End If
target = target.Parent
Loop
End Sub
Sub TreeHeaderClicked (ColumnTitle As String)
Log("Click: " & ColumnTitle)
End Sub