I also tried the onKeyPressed field, tho it doesn'...
# tornadofx
g
I also tried the onKeyPressed field, tho it doesn't take a lambda assignment, with a separate Handler class.
Hmmm. I added a mouseevent handler for clicking, that requests focus when I click. When I do this, the pane has the focus, and the keyevent fires correctly. So perhaps my question is how to requestFocus from the beginning?
r
Perhaps
requestFocus
from the JavaFX
Node
type can help? The docs indicate a caveat that "the node must be part of a scene and all of it's ancestors must be shown" so timing might be weird depending on when you call it.
g
Thanks. I should have posted the answer i guessed at and worked: handle the stage's WindowEvent.SHOWN and call the pane's `requestFocus()`then.
r
Ohhh cool, glad to hear it!