TAdvWebBrowser Set Focus

What is the correct way to set focus to the web browser control? The normal control.SetFocus does not seem to work and I have to click on the browser for the keyboard to work. I notice the standard VCL Edge browser control has provided "TCustomEdgeBrowser.SetFocus" so what is the equivalent for TAdvWebBrowser? Thanks.

Hi,

This is currently not implemented, but with a single line of code, you can add this after setting the focus to the control wrapper:

uses
  WinApi.WebView2;

procedure TForm1.Button1Click(Sender: TObject);
begin
  AdvWebBrowser1.SetFocus;
  ICoreWebView2Controller(AdvWebBrowser1.NativeBrowser).MoveFocus(COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC);
end;