Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim ta As TextArea
Dim ref As Reflector
Dim keycode As JavaObject
Dim tajo As JavaObject
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
keycode.InitializeStatic("javafx.scene.input.KeyCode")
ta.Initialize("ta")
tajo = ta
MainForm.RootPane.AddNode(ta,10,10,-1,-1)
ref.Target = ta
ref.AddEventFilter("ta","javafx.scene.input.KeyEvent.KEY_PRESSED")
End Sub
Sub ta_Filter(e As Event)
Dim KE As JavaObject = e
' check for shift control etc as they are used for form navigation
If KE.RunMethod("getCode",Null) = keycode.GetField("TAB") Then
If KE.RunMethod("isAltDown",Null) Or KE.RunMethod("isControlDown",Null) _
Or KE.RunMethod("isShiftDown",Null) Or KE.RunMethod("isMetaDown",Null)Then
Return
End If
e.Consume
' the spaces in last parameter is what tab gets replaced with
tajo.RunMethod("insertText",Array(tajo.RunMethodJO("getCaretPosition",Null)," "))
End If
End Sub