Skip to content

Global Keyboard Events and AddClassHandler #17432

Answered by maxkatz6
LaurentInSeattle asked this question in Q&A
Discussion options

You must be logged in to vote

Q1) Is there a better way to handle them, knowing they should be received even when non focused ?

If you own the window, it would be better to handle this event on the window directly with Tunnel strategy.
window.AddHandler(InputElement.KeyDownEvent, OnKeyDown, Tunnel, handledEventsToo: true) (pseudocode).

This way, you can avoid static global event handlers, and still handle events first.

knowing they should be received even when non focused ?

This will work for unfocused controls, but focused window. You can't intercept input outside of your app this way. There is no API for that.

It seems like there is no way to remove this hook when it becomes not needed any longer?

It returns a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LaurentInSeattle
Comment options

Answer selected by LaurentInSeattle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants