Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim tv As TableView
Dim index As List
Dim tf As TextField
Dim lab As Label
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
tv.Initialize("tv")
tv.SetColumns(Array("one","two","three"))
tv.setColumnWidth(0,100)
tv.setColumnWidth(1,100)
tv.setColumnWidth(2,100)
MainForm.RootPane.AddNode(tv,0,0,300,300)
For a = 0 To 100
tv.Items.Add(Array(a,"dummy","dummy#"&a))
Next
tf.Initialize("tf") ' for the search item
MainForm.RootPane.AddNode(tf,400,0,100,20)
lab.Initialize("")
MainForm.RootPane.AddNode(lab,400,50,100,20)
buildIndexOn(2) ' build index on col 2
End Sub
Sub buildIndexOn(col As Int)
index.Initialize
For Each item() As Object In tv.Items
index.Add(item(col))
Next
End Sub
Sub tf_Action
If index.IndexOf(tf.Text) <> -1 Then
tv.ScrollTo(index.IndexOf(tf.Text))
lab.Text = "Found"
Else
lab.Text = "Not found"
End If
End Sub