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.
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.
How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
-
- Posts: 3
- Joined: Tue Jan 14, 2025 11:54 pm
- salvadordf
- Posts: 4620
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
Edit the TMainForm.DoOnBeforePopup function and replace the "case targetDisposition of" block with the code for CEF_WOD_NEW_FOREGROUND_TAB :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.
https://github.com/salvadordf/CEF4Delphi/blob/373a19f8f512974d9c0c15b58fd5a5e009d3c24a/demos/Delphi_VCL/TabbedBrowser2/uMainForm.pas#L547
Read the code comments about TChromiumCore.OnFullScreenModeChange for more details.
Use the TChromiumCore.OnBeforeDownload event.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.
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.
-
- Posts: 3
- Joined: Tue Jan 14, 2025 11:54 pm
Re: How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
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;
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;
- salvadordf
- Posts: 4620
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
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;
-
- Posts: 3
- Joined: Tue Jan 14, 2025 11:54 pm
Re: How to make the full screen window appear in the tab of cef4delphi demo tabbrowser2 program
Thanks so much for your reply. Most Appreciated.