Hi,
In order to intercept the ENTER key for a button, as well as the LEFT and RIGHT arrow keys, they are intercepted thus:
The problem is that the btn_KeyPressed_Event is being triggered twice for any click or keypress. So if you press ENTER, it's triggered two times. If you click LEFT or RIGHT arrow, same thing.
As it turns out, this is ALSO true if you comment out the keypressed event above, and uncomment the click event. In that case, the btn_Click_Event gets triggered twice.
Does anyone have suggestions about how to avoid this, or to ignore the second trigger somehow? I'd hate to use a global counter, and check whether this is the second time triggered in order to ignore it.
Thanks,
In order to intercept the ENTER key for a button, as well as the LEFT and RIGHT arrow keys, they are intercepted thus:
B4X:
' obj_Reflector.AddEventHandler( "btn_Click", "javafx.scene.input.KeyEvent.ANY" )
obj_Reflector.AddEventHandler( "btn_KeyPressed", "javafx.scene.input.KeyEvent.ANY" )
The problem is that the btn_KeyPressed_Event is being triggered twice for any click or keypress. So if you press ENTER, it's triggered two times. If you click LEFT or RIGHT arrow, same thing.
As it turns out, this is ALSO true if you comment out the keypressed event above, and uncomment the click event. In that case, the btn_Click_Event gets triggered twice.
Does anyone have suggestions about how to avoid this, or to ignore the second trigger somehow? I'd hate to use a global counter, and check whether this is the second time triggered in order to ignore it.
Thanks,