AddEventHandler2 does not work if you do not have a button on the form?
Ex.:
This code works
This code does not work
Ex.:
This code works
B4X:
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
btn1.Initialize("btn1")
btn1.Text = "Test"
MainForm.RootPane.AddNode(btn1, 20, 20, 100, 25)
Dim Obj As Reflector
Obj.Target = MainForm.RootPane
Obj.AddEventHandler2("RootPaneKeyEvent", "onKeyReleasedProperty")
MainForm.Show
End Sub
Sub RootPaneKeyEvent_Event(e As Event)
...
...
End Sub
This code does not work
B4X:
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
Dim Obj As Reflector
Obj.Target = MainForm.RootPane
Obj.AddEventHandler2("RootPaneKeyEvent", "onKeyReleasedProperty")
MainForm.Show
End Sub
Sub RootPaneKeyEvent_Event(e As Event)
...
...
End Sub