From 3fef420ffff2356a63e4158597a4aaf8a93b4cf3 Mon Sep 17 00:00:00 2001 From: salvadordf Date: Fri, 3 Dec 2021 18:34:44 +0100 Subject: [PATCH] Fixed a size issue in SimpleFMXBrowser with a high DPI screen --- .../SimpleFMXBrowser/uSimpleFMXBrowser.fmx | 7 +++++++ .../SimpleFMXBrowser/uSimpleFMXBrowser.pas | 16 +++++++++++----- update_CEF4Delphi.json | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/demos/Delphi_FMX_Windows/SimpleFMXBrowser/uSimpleFMXBrowser.fmx b/demos/Delphi_FMX_Windows/SimpleFMXBrowser/uSimpleFMXBrowser.fmx index 0aad32a6..79f93f49 100644 --- a/demos/Delphi_FMX_Windows/SimpleFMXBrowser/uSimpleFMXBrowser.fmx +++ b/demos/Delphi_FMX_Windows/SimpleFMXBrowser/uSimpleFMXBrowser.fmx @@ -78,6 +78,13 @@ object SimpleFMXBrowserFrm: TSimpleFMXBrowserFrm Left = 40 Top = 192 end + object BrowserLay: TLayout + Align = Client + Size.Width = 1000.000000000000000000 + Size.Height = 565.000000000000000000 + Size.PlatformDefault = False + TabOrder = 6 + end object FMXChromium1: TFMXChromium OnBeforeContextMenu = FMXChromium1BeforeContextMenu OnContextMenuCommand = FMXChromium1ContextMenuCommand diff --git a/demos/Delphi_FMX_Windows/SimpleFMXBrowser/uSimpleFMXBrowser.pas b/demos/Delphi_FMX_Windows/SimpleFMXBrowser/uSimpleFMXBrowser.pas index c8014c3e..177d42f1 100644 --- a/demos/Delphi_FMX_Windows/SimpleFMXBrowser/uSimpleFMXBrowser.pas +++ b/demos/Delphi_FMX_Windows/SimpleFMXBrowser/uSimpleFMXBrowser.pas @@ -66,6 +66,7 @@ type Layout1: TLayout; GoBtn: TButton; SnapShotBtn: TButton; + BrowserLay: TLayout; procedure GoBtnClick(Sender: TObject); procedure Timer1Timer(Sender: TObject); @@ -377,6 +378,7 @@ begin begin FClosing := True; Visible := False; + FMXChromium1.CloseBrowser(True); end; end; @@ -403,10 +405,10 @@ var TempScale : single; begin TempScale := FMXChromium1.ScreenScale; - Result.Left := 0; - Result.Top := round(AddressPnl.Height * TempScale); - Result.Right := round(ClientWidth * TempScale) - 1; - Result.Bottom := round(ClientHeight * TempScale) - 1; + Result.Left := round(BrowserLay.Position.x); + Result.Top := round(BrowserLay.Position.y); + Result.Right := Result.Left + round(BrowserLay.Width * TempScale); + Result.Bottom := Result.Top + round(BrowserLay.Height * TempScale); end; procedure TSimpleFMXBrowserFrm.ResizeChild; @@ -473,7 +475,9 @@ begin TempRect.Bottom := round(TempClientRect.Bottom); FMXChromium1.DefaultUrl := AddressEdt.Text; - if not(FMXChromium1.CreateBrowser(TempHandle, TempRect)) then Timer1.Enabled := True; + + if not(FMXChromium1.CreateBrowser(TempHandle, TempRect)) then + Timer1.Enabled := True; end; end; @@ -487,7 +491,9 @@ var PositionChanged: Boolean; begin PositionChanged := (ALeft <> Left) or (ATop <> Top); + inherited SetBounds(ALeft, ATop, AWidth, AHeight); + if PositionChanged then NotifyMoveOrResizeStarted; end; diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index 14f31069..8e4a6e90 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,7 +2,7 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 338, + "InternalVersion" : 339, "Name" : "cef4delphi_lazarus.lpk", "Version" : "96.0.16.0" }