Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Dim r As Reflector
For Each v As B4XView In Root.GetAllViewsRecursive
If v Is TextArea Then
r.Target = v
r.AddEventFilter("keypressed", "javafx.scene.input.KeyEvent.ANY")
End If
Next
End Sub
Sub KeyPressed_Filter (e As Event)
Dim jo As JavaObject = e
Log(e)
Dim eventType As String = jo.RunMethod("getEventType", Null)
Dim code As String = jo.RunMethod("getCode", Null)
If code = "TAB" And eventType = "KEY_PRESSED" Then
Dim v As B4XView = jo.RunMethod("getSource", Null)
For i = 0 To Root.NumberOfViews - 1
If Root.GetView(i) = v Then
Dim NextView As B4XView = Root.GetView((i + 1) Mod Root.NumberOfViews)
NextView.RequestFocus
Exit
End If
Next
e.Consume
End If
End Sub