ActiveControl for CEF
Created by: mcdurdin
We have found that CEF4Delphi does not update the parent form's (or TScreen
's) ActiveControl
property when focused. This means that TAction and other interactions think the wrong control has focus when they are updated.
As a workaround we did the following (cefwp
is a TCEFWindowParent
control):
procedure TframeCEFHost.cefWidgetCompMsg(var aMessage: TMessage; var aHandled: Boolean);
begin
if aMessage.Msg = WM_SETFOCUS then
if cefwp.Visible and cefwp.CanFocus then
GetParentForm(cefwp).ActiveControl := cefwp;
end;
However, something of this nature would be better placed in the component itself -- and there may be a cleaner way of implementing this with Chromium's existing focus events (although OnGotFocus
and related events did not fire at the appropriate time)