Hi all, how can I read windows mouse and keyboard events with B4J.
Thank you
Add the jreflector library from the library tab.
Not sure if this is required.
#PackagerProperty: IncludedModules = jdk.charsets, javafx.web
Add the following code
Sub AddKeyPressedListener
Dim r As Reflector
r.Target = MainForm.RootPane
r.AddEventHandler("keypressed", "javafx.scene.input.KeyEvent.KEY_PRESSED")
End Sub
Sub KeyPressed_Event (e As Event)
Dim jo As JavaObject = e
Dim keycode As String = jo.RunMethod("getCode", Null)
'Log(keycode)
If tblData.Visible = True Then
If ltype = "D" Then
If keycode = "F" Then 'Fields
Button1_Click
End If
If keycode = "K" Then 'Keys
Button2_Click
End If
If keycode = "I" Then 'Indexes
Button3_Click
End If
If keycode = "W" Then 'Where used
Button4_Click
End If
End If
If ltype = "N" Then
If keycode = "F" Then 'Fields
Button1_Click
End If
If keycode = "W" Then 'Where used
Button2_Click
End If
End If
If ltype = "F" Then
If keycode = "W" Then 'Where used
Button1_Click
End If
End If
If ltype = "P" Then
If keycode = "C" Then 'Call Stack
Button1_Click
End If
If keycode = "V" Then 'View source
Button2_Click
End If
If keycode = "O" Then 'Objects used
Button3_Click
End If
End If
End If
End Sub