Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private ListView1 As ListView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
For i = 1 To 10
AddTwoLines2(ListView1, "This it the Title", "This is the second line", i)
Next
End Sub
Sub AddTwoLines2(lv As ListView, Line1 As String, Line2 As String, Value As Object)
Dim ap As AnchorPane
ap.Initialize("")
Dim lbl1, lbl2 As Label
lbl1.Initialize("")
lbl1.Text = Line1
lbl1.Font = fx.DefaultFont(16)
lbl2.Initialize("")
lbl2.Text = Line2
ap.AddNode(lbl1, 0, 0, lv.Width, 20dip)
ap.AddNode(lbl2, 0, 25dip, lv.Width, 20dip)
lv.Items.Add(ap)
lbl1.Tag = Value
End Sub
Sub ListView1_SelectedIndexChanged(Index As Int)
If Index > = -1 Then
Dim ap As AnchorPane = ListView1.SelectedItem
Dim lbl1 As Label = ap.GetNode(0)
Dim value As Object = lbl1.Tag
Log(value)
End If
End Sub