Page 1 of 1
How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
Posted: Wed Jan 15, 2025 12:14 am
by cefbeginner
I am modifying the demo tabbrowser2 to apply to my multi-tab application and encountered two problems.
1. Some web pages are full-screen windows,When opened with tabbrowser2, they are not displayed in the tab, but are displayed in full screen and cover the application interface, and there is no close button. I would like to ask how to modify the code in the onbeforepopup event so that the full-screen window is embedded in the tab.
2. tabbrowser2 does not respond to the download link page when clicking the download link. How to solve it?
Thank you.
Re: How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
Posted: Wed Jan 15, 2025 2:47 pm
by salvadordf
cefbeginner wrote: Wed Jan 15, 2025 12:14 am
I am modifying the demo tabbrowser2 to apply to my multi-tab application and encountered two problems.
1. Some web pages are full-screen windows,When opened with tabbrowser2, they are not displayed in the tab, but are displayed in full screen and cover the application interface, and there is no close button. I would like to ask how to modify the code in the onbeforepopup event so that the full-screen window is embedded in the tab.
Edit the TMainForm.DoOnBeforePopup function and replace the "
case targetDisposition of" block with the code for CEF_WOD_NEW_FOREGROUND_TAB :
https://github.com/salvadordf/CEF4Delphi/blob/373a19f8f512974d9c0c15b58fd5a5e009d3c24a/demos/Delphi_VCL/TabbedBrowser2/uMainForm.pas#L547
Read the code comments about TChromiumCore.OnFullScreenModeChange for more details.
cefbeginner wrote: Wed Jan 15, 2025 12:14 am
2. tabbrowser2 does not respond to the download link page when clicking the download link. How to solve it?
Thank you.
Use the TChromiumCore.OnBeforeDownload event.
See the code in the MiniBrowser demo :
https://github.com/salvadordf/CEF4Delphi/blob/373a19f8f512974d9c0c15b58fd5a5e009d3c24a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L495
Read the code comments of that event for more details.
Re: How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
Posted: Wed Jan 15, 2025 10:15 pm
by cefbeginner
Thank you for your reply. I could step into TMainForm.DoOnBeforePopup to find the pattern of this full-screen pop-up in the program and modify the case statement。I don't know how to modify the code.can you help me ?
function TMainForm.DoOnBeforePopup(var windowInfo : TCefWindowInfo;
var client : ICefClient;
const targetFrameName : string;
const popupFeatures : TCefPopupFeatures;
targetDisposition : TCefWindowOpenDisposition) : boolean;
begin
if GlobalCEFApp.ChromeRuntime then
Result := False
else
try
FCriticalSection.Acquire;
case targetDisposition of
WOD_NEW_FOREGROUND_TAB:Result :=??? //can you help me
WOD_NEW_BACKGROUND_TAB :
Result := (FHiddenTab <> nil) and
FHiddenTab.CreateClientHandler(windowInfo, client, targetFrameName, popupFeatures) and
PostMessage(Handle, CEF_CREATENEXTTAB, 0, ord(False));
WOD_NEW_WINDOW,
WOD_NEW_POPUP :
Result := (FChildForm <> nil) and
FChildForm.CreateClientHandler(windowInfo, client, targetFrameName, popupFeatures) and
PostMessage(Handle, CEF_CREATENEXTCHILD, 0, ord(False));
else Result := False;
end;
finally
FCriticalSection.Release;
end;
end;
Re: How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
Posted: Fri Jan 17, 2025 11:12 am
by salvadordf
Code: Select all
function TMainForm.DoOnBeforePopup(var windowInfo : TCefWindowInfo;
var client : ICefClient;
const targetFrameName : string;
const popupFeatures : TCefPopupFeatures;
targetDisposition : TCefWindowOpenDisposition) : boolean;
begin
try
FCriticalSection.Acquire;
Result := (FHiddenTab <> nil) and (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_WINDOW, WOD_NEW_POPUP]) and
FHiddenTab.CreateClientHandler(windowInfo, client, targetFrameName, popupFeatures) and
PostMessage(Handle, CEF_CREATENEXTTAB, 0, ord(False));
finally
FCriticalSection.Release;
end;
end;
Re: How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
Posted: Sun Jan 19, 2025 8:54 am
by cefbeginner
Thanks so much for your reply. Most Appreciated.