salvadordf / OldCEF4Delphi

OldCEF4Delphi is an open source project to embed Chromium-based browsers in applications made with Delphi.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When you open DevTools, Chromium 1 KeyEvent cannot capture keyboard messages. I want to turn DevTools on and off via F12.

lobtao opened this issue · comments

When you open DevTools, Chromium 1 KeyEvent cannot capture keyboard messages. I want to turn DevTools on and off via F12.

The MiniBrowser demo has the code to show and hide the DevTools with F12.
You need to use the TChromium.OnPreKeyEvent and TChromium.OnKeyEvent events to capture the key press and then send a message to the main form to show or hide the DevTools.
That demo also has a context menu option to show the DevTools and it uses the last mouse coordinates in a parameter to inspect the HTML element under the mouse.

When DevTools is displayed, Chromium 1 loses focus. Press F12 again, and the DevTools window will not be closed. You need to click to activate Chromium 1 to trigger keyboard events.

Thanks! I'll take a look as soon as I can.
Reopening this issue...

TChromium now uses the same event for the keyboard events coming from the browser and the DevTools. The MiniBrowser also sets the focus to the browser when it hides the DevTools and F12 works correctly.