Enahor Tapmas
02/24/2024, 6:50 AMWindow(onCloseRequest = ::exitApplication, onKeyEvent = {
if (it.key == Key.Escape && escEventAllowed){
escEventAllowed = false
println("ESC")
BackPressureHandler.execute()
Thread {
println("escHold")
Thread.sleep(WAIT_FOR_ESC)
println("escRelease")
escEventAllowed = true
}.start()
}
false
})
I am using the onKeyEvent ability when I create my Window for the desktop main. It is registering escape multiple times instead of just once, and the thread is not helping, any ideas?Ivan Matkov
02/24/2024, 9:38 AMEnahor Tapmas
02/24/2024, 12:33 PMIvan Matkov
02/24/2024, 12:38 PMit.type == KeyEventType.KeyDown
Enahor Tapmas
02/25/2024, 5:48 AM