Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Browser (FMXWindowParent) size.

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

Browser (FMXWindowParent) size.

Post by Tagruato »

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: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Browser (FMXWindowParent) size.

Post by salvadordf »

Hi,

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

Or use this code if your Delphi version doesn't have that feature :
https://stackoverflow.com/questions/192 ... monkey-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 »

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: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Browser (FMXWindowParent) size.

Post by salvadordf »

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/CEF4Delph ... r.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 »

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