Page 1 of 1

Re: How to SetFocus to TChromiumWindow

Posted: Tue Dec 11, 2018 9:56 am
by petko
Vuio wrote: Sun Mar 25, 2018 4:36 am

Code: Select all

procedure TForm1.CheckBox1Click (Sender : TObject);
    begin
      Self.ActiveControl:=ChromiumWindow1;
      ChromiumWindow1.SetFocus;
      PostMessage(Handle,WM_SETFOCUS,0,0);
    end;
Unit WinAPI.Windows and Messages are neccessary
It seems that the

Code: Select all

ChromiumWindow1.SetFocus;
is not needed. Works with just:

Code: Select all

procedure TForm1.CheckBox1Click (Sender : TObject);
    begin
      Self.ActiveControl:=ChromiumWindow1;
      PostMessage(Handle,WM_SETFOCUS,0,0);
    end;
Thanks for the tip though!