Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alternatives of old IE methods
#10
Hi,




Thanks.




re. catching key events for accelerator keys.




You can actually handle this via javascript as well (I just tested that here)




If you add the following bit of code:



Code:
window.addEventListener("keypress", function(event) {
  if (!(event.which == 115 && event.ctrlKey) && !(event.which == 19)) return true
  alert("Ctrl-S pressed")
  event.preventDefault()
  return false
})
and run that for the currently loaded document.

After the above has run, you'll see that pressing "Ctrl+S" does indeed pop up the alert box.




If you want to instead handle something in your host application then instead of using "alert" you can pass data to your host application via a postmessage event.



An example of how this works can be seen in the webmessage example.



See the VB6 webmessage demo explanation for some details on that and the demo code itself under the Public Documents AntView folder.




On top of that, there is a way right now for handling accelerator keys in the C++ API of the WebView2 control.



From the sounds of it that might also help for your current needs.

Note that what Microsoft offers there is for accelerator keys only, so no general keyboard event as to what you used to have with the old MS browsercontrol.




I will look into this, but need a bit of time for adding support for it while I"m slowly catching up with things.




--


Wil
Reply


Messages In This Thread
Alternatives of old IE methods - by hsacrm - 2022-08-30, 07:34:20
RE: Alternatives of old IE methods - by wila - 2022-08-30, 10:17:06
RE: Alternatives of old IE methods - by Patrickb - 2022-11-03, 20:10:42
RE: Alternatives of old IE methods - by hsacrm - 2022-08-30, 13:05:33
RE: Alternatives of old IE methods - by wila - 2022-08-30, 17:12:07
RE: Alternatives of old IE methods - by hsacrm - 2022-08-31, 07:32:58
RE: Alternatives of old IE methods - by wila - 2022-08-31, 11:02:56
RE: Alternatives of old IE methods - by hsacrm - 2022-09-09, 14:00:43
RE: Alternatives of old IE methods - by wila - 2022-09-10, 17:45:32
RE: Alternatives of old IE methods - by hsacrm - 2022-09-12, 06:39:00
RE: Alternatives of old IE methods - by wila - 2022-09-12, 12:44:00
RE: Alternatives of old IE methods - by wila - 2022-09-13, 22:20:57
RE: Alternatives of old IE methods - by hsacrm - 2022-09-14, 13:01:42
RE: Alternatives of old IE methods - by wila - 2022-09-14, 14:02:43
RE: Alternatives of old IE methods - by wila - 2022-11-03, 21:02:38
RE: Alternatives of old IE methods - by Patrickb - 2022-11-15, 20:12:43
RE: Alternatives of old IE methods - by wila - 2022-11-15, 22:54:47
RE: Alternatives of old IE methods - by Patrickb - 2022-11-16, 15:41:16
RE: Alternatives of old IE methods - by wila - 2022-11-16, 16:08:59

Forum Jump:


Users browsing this thread: 2 Guest(s)