Page 1 of 1

SendKeyEvent

Posted: Thu May 18, 2023 8:13 pm
by alpires2000
Hi Salvador,
In CEF I use Chromium1.SendKeyEvent to send a keyboard event to the browser, there is something similar in WebView4?
Thanks

Re: SendKeyEvent

Posted: Sat May 20, 2023 8:48 am
by salvadordf
Hi,

Try using TWVBrowserBase.SimulateKeyEvent.

Read the code comments for that function. It uses the "Input.dispatchKeyEvent" DevTools method :
https://chromedevtools.github.io/devtools-protocol/1-3/Input/#method-dispatchKeyEvent

See the TWVBrowserBase.KeyboardShortcutSearch and TWVBrowserBase.KeyboardShortcutRefreshIgnoreCache functions as an example.
I used the SimpleOSRBrowser demo in CEF4Delphi to get the KeyCode parameter values ;)