user2787928
user2787928

Reputation: 31

How to set focus of a TChromium browser window in DCEF 3?

In DCEF 1 (Delphi Chromium Embedded 1), I've used TChromium.Browser.SetFocus(True); to set focus of a browser window, but in DCEF 3 I can't find a way to set focus of this window.

Does anyone know how to set focus of a TChromium browser window in DCEF 3 ?

Upvotes: 1

Views: 1578

Answers (2)

Delhpi
Delhpi

Reputation: 71

procedure TWinControl.SetFocus;

TCustomChromium = class(TWinControl, IChromiumEvents)

TChromium is a TWinControl.

Upvotes: 0

user2787928
user2787928

Reputation: 31

Thanks for TLama

function CefWndProc(Wnd: HWND; message: UINT; wParam: Integer; lParam: Integer):  Integer; stdcall;
begin
  case message of
    WM_SETFOCUS:
      begin
        if brows <> nil then
          PostMessage(brows.Host.WindowHandle, WM_SETFOCUS, wParam, 0);
        Result := 0;
      end;
    //...
    else
      result := DefWindowProc(Wnd, message, wParam, lParam);
 end;
end;    

//MyChromium.Browser.Host.SetFocus(true);

Upvotes: 2

Related Questions