Page 1 of 1
Setting screen and windows dimentions in old CEF
Posted: Tue Aug 11, 2020 11:44 am
by andreykrasnodar
There are OnGetViewRect and OnGetScreenInfo events in newer versions, but there is only 1st event in my version.
Using Demo code, I can set equal screen resolution and window's dimensions.
How can I set different resolution and dimension?
Thanks.
Re: Setting screen and windows dimentions in old CEF
Posted: Wed Aug 12, 2020 7:10 am
by salvadordf
Using TChromium.OnGetViewRect you can configure CEF to use a surface with different dimmensions than your form to draw the web contents.
Read this page for more information about those events :
https://magpcss.org/ceforum/apidocs3/pr ... ndler.html
Re: Setting screen and windows dimentions in old CEF
Posted: Wed Aug 12, 2020 8:30 am
by dilfich
salvadordf wrote: Wed Aug 12, 2020 7:10 am
Using TChromium.OnGetViewRect you can configure CEF to use a surface with different dimmensions than your form to draw the web contents.
This only works in the OSR version, doesn't it?)
For the normal version only by script(
viewtopic.php?f=8&t=1382&p=5744#p5744
Re: Setting screen and windows dimentions in old CEF
Posted: Wed Aug 12, 2020 8:32 am
by salvadordf
That's correct. All those events only work in OSR mode.
Re: Setting screen and windows dimentions in old CEF
Posted: Wed Aug 12, 2020 10:50 am
by andreykrasnodar
You are right, I am using OSR component. And want to set the size of screen and window.
Re: Setting screen and windows dimentions in old CEF
Posted: Fri Aug 14, 2020 2:09 pm
by andreykrasnodar
Please help me
Re: Setting screen and windows dimentions in old CEF
Posted: Sat Aug 15, 2020 10:34 am
by salvadordf
If the CEF version you use doesn't have the OnGetScreenInfo event then you can't set a custom screen resolution.
You need to use a newer CEF version.
Re: Setting screen and windows dimentions in old CEF
Posted: Sun Aug 16, 2020 3:44 pm
by andreykrasnodar
Re: Setting screen and windows dimentions in old CEF
Posted: Mon Aug 17, 2020 11:49 am
by dilfich
Code: Select all
// Screen resolution
procedure GetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean);
var
TempRect : TCEFRect;
begin
if (GlobalCEFApp <> nil) then
begin
TempRect.x := 0;
TempRect.y := 0;
TempRect.width := ScreenWidth[FCefID];
TempRect.height := ScreenHeight[FCefID];
screenInfo.device_scale_factor := GlobalCEFApp.DeviceScaleFactor;
screenInfo.depth := 0;
screenInfo.depth_per_component := 0;
screenInfo.is_monochrome := Ord(False);
screenInfo.rect := TempRect;
screenInfo.available_rect := TempRect;
Result := True;
end
else
Result := False;
end;
// Browser's resolution
procedure GetViewRect(Sender : TObject; const browser : ICefBrowser; var rect : TCefRect);
begin
if (GlobalCEFApp <> nil) then
begin
rect.x := 0;
rect.y := 0;
rect.width := BrowsrWidth[FCefID];
rect.height := BrowsrHeight[FCefID];
end;
end;
After installation, use
Chromium.WasResized;
Re: Setting screen and windows dimentions in old CEF
Posted: Thu Aug 27, 2020 8:01 am
by andreykrasnodar
Thanks, it works.