1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-07-12 22:30:17 +02:00

Extracted base-class for TCefWindow with Chromium / Move WndProc

This commit is contained in:
martin
2021-02-23 17:37:10 +01:00
parent ff9d2a39a8
commit c7fba0eb39
3 changed files with 50 additions and 75 deletions

View File

@ -75,9 +75,6 @@ type
function GetChromium: TChromium; override;
procedure SetChromium(aValue : TChromium);
{$IFDEF MSWINDOWS}
procedure WndProc(var aMessage: TMessage); override;
{$ENDIF}
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
@ -105,41 +102,6 @@ begin
FChromium := nil;
end;
{$IFDEF MSWINDOWS}
procedure TCEFLinkedWindowParent.WndProc(var aMessage: TMessage);
var
TempHandle : THandle;
begin
case aMessage.Msg of
WM_SETFOCUS:
begin
if (FChromium <> nil) then
FChromium.SetFocus(True)
else
begin
TempHandle := ChildWindowHandle;
if (TempHandle <> 0) then PostMessage(TempHandle, WM_SETFOCUS, aMessage.WParam, 0);
end;
inherited WndProc(aMessage);
end;
WM_ERASEBKGND:
if (ChildWindowHandle = 0) then inherited WndProc(aMessage);
CM_WANTSPECIALKEY:
if not(TWMKey(aMessage).CharCode in [VK_LEFT .. VK_DOWN, VK_RETURN, VK_ESCAPE]) then
aMessage.Result := 1
else
inherited WndProc(aMessage);
WM_GETDLGCODE : aMessage.Result := DLGC_WANTARROWS or DLGC_WANTCHARS;
else inherited WndProc(aMessage);
end;
end;
{$ENDIF}
procedure TCEFLinkedWindowParent.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited Notification(AComponent, Operation);