salvadordf / WebView4Delphi

WebView4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows.
https://www.briskbard.com/forum/
MIT License
280 stars 56 forks source link

Acceleration Keys are not handled #46

Closed ZeroGit2015 closed 7 months ago

ZeroGit2015 commented 7 months ago

"OnAccelerationKeyPressed" event doesn't trigger when Search dialog window (Ctrl+F) was activated. Can i handle all acceleration keys except Ctrl+F?

salvadordf commented 7 months ago

Hi,

Read these code comments for all the details about intercepting the browser accelerator keys :

  1. TWVBrowser.OnAcceleratorKeyPressed.
  2. TCoreWebView2AcceleratorKeyPressedEventArgs.IsBrowserAcceleratorKeyEnabled.
  3. TWVBrowser.AreBrowserAcceleratorKeysEnabled.

If you just want to disable all browser accelerators then set this property in your app : TWVBrowser.AreBrowserAcceleratorKeysEnabled := False;

ZeroGit2015 commented 7 months ago

I don't want to disable ALL accelerators. I want disable Ctrl + U only, for example, I use TWVBrowser.OnAcceleratorKeyPressed for disable Ctrl+U, It works in main browser window, but when i press Ctrl + F (internal search windows is shown) Ctrl + U works again and event TWVBrowser.OnAcceleratorKeyPressed doesn't trigger (when search window is opened).

salvadordf commented 7 months ago

I can reproduce this issue but I'm afraid it's an upstream WebView2 issue. You can report it in the feedback repository.

This should be fixed when Microsoft adds a complete keyboard and mouse filtering API.

Until then we can only try the low level keyboard hook workaround.

ZeroGit2015 commented 7 months ago

Until then we can only try the low level keyboard hook workaround. It works. Very thx!!!!