(Most likely this should be a "wish").
How to set a default button (one of the three) so that its click event fires when Enter is pressed?
Note that I tried:
but it doesn't seem to work.
EDIT - I found a way, to improve (make it general routines):
How to set a default button (one of the three) so that its click event fires when Enter is pressed?
Note that I tried:
B4X:
xDialog.GetButton(xui.DialogResponse_Cancel).As(Button).RequestFocus
EDIT - I found a way, to improve (make it general routines):
B4X:
Dim r As Reflector
r.Target = xDialog.GetButton(xui.DialogResponse_Cancel).As(Button)
r.AddEventFilter("DlgBtn", "javafx.scene.input.KeyEvent.KEY_PRESSED")
r.AddEventFilter("DlgBtn", "javafx.scene.input.KeyEvent.KEY_RELEASED")
B4X:
Sub DlgBtn_Filter (EventData As Event)
Dim jo As JavaObject = EventData
Dim Code As String = jo.RunMethod("getCode", Null)
Dim EventType As String = jo.RunMethod("getEventType", Null)
Log(Code)
Log(EventType)
End Sub
Last edited: