Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

How to SetFocus to TChromiumWindow

Post Reply
petko
Posts: 52
Joined: Sun Jul 02, 2017 9:58 am

Re: How to SetFocus to TChromiumWindow

Post 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!
Post Reply