Browser (FMXWindowParent) size.

Post Reply
Tagruato
Posts: 3
Joined: Sat May 16, 2020 11:01 pm

Browser (FMXWindowParent) size.

Post by Tagruato » Sat May 16, 2020 11:27 pm

Me need full screen browser without "full screen mode", for open "TRADE" page of "PATH OF EXILE" game.
I set size of the form in FormCreate

Code: Select all

  Left := 0;
  Top := 0;
  Width := VCL.Forms.Screen.DesktopWidth; // MONITOR RESOLUTION: X
  Height := VCL.Forms.Screen.DesktopHeight; // MONITOR RESOLUTION: Y
But in practice this
Image
How i can fix this?
P.S.FMX Application (VCL.Forms uses only for get monitor resolution).

User avatar
salvadordf
Posts: 2597
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Browser (FMXWindowParent) size.

Post by salvadordf » Sun May 17, 2020 6:59 am

Hi,

Use FMX.Forms.TScreen.Size to get the screen dimensions in logical units.
http://docwiki.embarcadero.com/Libraries/Rio/en/FMX.Forms.TScreen.Size

Or use this code if your Delphi version doesn't have that feature :
https://stackoverflow.com/questions/19213129/how-to-get-screen-size-in-firemonkey-fm3

If your monitor uses high DPI I would suggest that you set it to 100% (96 DPI) while you develop the first versions of the web browser. Once you have everything working then set the resolution to the original DPI value to fix the high DPI issues in the last step.

Tagruato
Posts: 3
Joined: Sat May 16, 2020 11:01 pm

Re: Browser (FMXWindowParent) size.

Post by Tagruato » Sun May 17, 2020 2:46 pm

How can this help me with my problem?
Since the browser when showing is shifted by X, Y coordinates (they must be 0, 0)
My monitor: 1600x900 (VCL.Forms.Screen.DesktopWidth and VCL.Forms.Screen.DesktopHeight too 1600 and 900), and DPI set always default 100% (96 DPI).

User avatar
salvadordf
Posts: 2597
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Browser (FMXWindowParent) size.

Post by salvadordf » Sun May 17, 2020 3:13 pm

Please, check that your application is calling "SetBounds" for the TFMXWindowParent component.

The SimpleFMXBrowser demo calls TFMXWindowParent.SetBounds when the main form is resized :
https://github.com/salvadordf/CEF4Delphi/blob/58d988487bcd11c5f9207a2841dbd7f2fd8e8f9b/demos/Delphi_FMX/SimpleFMXBrowser/uSimpleFMXBrowser.pas#L412

That procedure sets the size and position of TFMXWindowParent using the TRect returned by TSimpleFMXBrowserFrm.GetFMXWindowParentRect.

Notice that GetFMXWindowParentRect uses the FMXChromium1.ScreenScale value to calculate the position of TFMXWindowParent and FMXChromium1.ScreenScale is calculated based on the monitor DPI value.

Tagruato
Posts: 3
Joined: Sat May 16, 2020 11:01 pm

Re: Browser (FMXWindowParent) size.

Post by Tagruato » Sun May 17, 2020 3:27 pm

I fix this problem, in CreateFMXWindowParent, here

Code: Select all

begin
  if (FMXWindowParent = nil) then
  begin
    FMXWindowParent := TFMXWindowParent.CreateNew(nil);
    FMXWindowParent.Position := TFormPosition.Designed; // <--
    FMXWindowParent.Reparent(Handle);
    ResizeChild;
    FMXWindowParent.Show;
  end;
end;

Post Reply