如何在DCEF 3中设置TChromium浏览器窗口的焦点?

时间:2013-09-23 14:31:29

标签: delphi tchromium

DCEF 1(Delphi Chromium Embedded 1)中,我使用TChromium.Browser.SetFocus(True);来设置浏览器窗口的焦点,但在DCEF 3我找不到设置焦点的方法这个窗口。

有谁知道如何在DCEF 3中设置TChromium浏览器窗口的焦点?

2 个答案:

答案 0 :(得分:2)

感谢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);

答案 1 :(得分:0)

procedure TWinControl.SetFocus;

TCustomChromium = class(TWinControl, IChromiumEvents)

TChromium是TWinControl。