Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim lv As ListView
Dim ref As Reflector
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
lv.Initialize("lv")
lv.Items.AddAll(Array("a","b","c","d","e","f","g"))
MainForm.RootPane.AddNode(lv,10,10,-1,50) ' short height to force scrollbars
ref.Target=lv
ref.AddEventHandler("search","javafx.scene.input.KeyEvent.KEY_TYPED")
End Sub
Sub search_Event(e As Event)
Dim jo As JavaObject = e
Dim searchChar As String = jo.RunMethod("getCharacter",Null)
Log(searchChar)
For t = 0 To lv.Items.Size -1
Dim ss As String = lv.Items.Get(t)
If searchChar.EqualsIgnoreCase(ss.CharAt(0)) Then lv.ScrollTo(t)
Next
e.Consume
End Sub