Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Catching keyevents
#9
(2023-01-02, 14:29:06)hsacrm Wrote: Yes, it works! Thank you very much.

I've played a bit around with it. The behaviour is somewhat different than what i expected.
Am i correct when saying that the keyaccelator only work when pressing a key modifier? (Ctrl, alt etc)
The way it activates may bring some difficulties, to catch ctrl + s for example. The function gets called allot of times when holding down the ctrl-key (which even lead to a crash once).
We can reduce it by checking if the key is released.  It will then get called twice. Once for the ctrl-key and once for the S-key. So i think we have to build something to wait till the key get released and check what was pressed in the meantime.

We have to play around it a bit more to fully grasp it, but we're getting there!

Glad to hear that you got it to work.
Yes, this interface only works for accelerator keys.
So shortcut keys with modifier keys like you say, but it also supports some special keys like Escape and function keys.

Yes, it is different from what you expect.
The reason for that is as I explained earlier here [1], let me quote.
The problem is that the WebView2 control is Out-Of-Process and has an In-Process front end.
So while you're typing in the -out of process- control, the -in process- front end doesn't get any of those events.


It would be good if MS adds a proper interface for keyboard events.
But at least you can catch short cut keys now without having to do this at the javascript layer.

--
Wil
Reply


Messages In This Thread
Catching keyevents - by hsacrm - 2022-12-29, 13:39:15
RE: Catching keyevents - by wila - 2022-12-29, 14:07:06
RE: Catching keyevents - by hsacrm - 2022-12-29, 15:20:45
RE: Catching keyevents - by wila - 2022-12-29, 18:43:07
RE: Catching keyevents - by hsacrm - 2023-01-02, 08:21:44
RE: Catching keyevents - by wila - 2023-01-02, 11:50:42
RE: Catching keyevents - by wila - 2023-01-02, 13:18:59
RE: Catching keyevents - by hsacrm - 2023-01-02, 14:29:06
RE: Catching keyevents - by wila - 2023-01-02, 15:03:32
RE: Catching keyevents - by hsacrm - 2023-01-04, 14:34:38
RE: Catching keyevents - by wila - 2023-01-04, 14:50:29
RE: Catching keyevents - by hsacrm - 2023-01-04, 15:43:49
RE: Catching keyevents - by wila - 2023-01-04, 17:05:43
RE: Catching keyevents - by wila - 2023-01-04, 17:34:32
RE: Catching keyevents - by hsacrm - 2023-01-05, 11:00:10
RE: Catching keyevents - by wila - 2023-01-05, 11:39:41
RE: Catching keyevents - by hsacrm - 2023-01-05, 12:50:00
RE: Catching keyevents - by wila - 2023-01-05, 16:28:34
RE: Catching keyevents - by hsacrm - 2023-01-06, 07:39:15

Forum Jump:


Users browsing this thread: 1 Guest(s)