The recently added "onBeforeClose" event never fires using TChromiumWindow.
Tested using SimpleBrowser.
I was trying to create a multi-tab browser using TChromiumWindow. The needed event never fires so I can't free the browser object and close the window tab. Any ideas why?
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.
TChromiumWindow onBeforeClose not firing
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: TChromiumWindow onBeforeClose not firing
Hi,
The complete destruction sequence for TChromiumWindow is described in the code comments inside the SimpleExternalPumpBrowser demo :
https://github.com/salvadordf/CEF4Delph ... rowser.pas
Run that demo and use a breakpoint in ChromiumWindow1BeforeClose.
The complete destruction sequence for TChromiumWindow is described in the code comments inside the SimpleExternalPumpBrowser demo :
https://github.com/salvadordf/CEF4Delph ... rowser.pas
Run that demo and use a breakpoint in ChromiumWindow1BeforeClose.
Re: TChromiumWindow onBeforeClose not firing
I tried the breakpoint before and followed many guides on the destruction sequence. No positive results.
All using the SimpleBrowser.
FYI: I'm using the latest build CEF 3.3239.1723.g071d1c1 on Delphi 2006 (Yes, I know, but I love the old bcc)
All using the SimpleBrowser.
FYI: I'm using the latest build CEF 3.3239.1723.g071d1c1 on Delphi 2006 (Yes, I know, but I love the old bcc)
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: TChromiumWindow onBeforeClose not firing
Hi,
The SimpleExternalPumpBrowser demo has a complete implementation of the destruction sequence for TChromiumWindow. Take its code as a reference for your application.
This is the destruction sequence implemented in that demo :
TChromiumWindow is a special component that has a slightly different destruction sequence and it's meant for quick browser implementations.
If your application creates several browsers I would recommend you to use the usual TChromium + TCEFWindowParent combination.
The SimpleExternalPumpBrowser demo has a complete implementation of the destruction sequence for TChromiumWindow. Take its code as a reference for your application.
This is the destruction sequence implemented in that demo :
- The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser, which triggers the TChromiumWindow.OnClose event.
- The TChromiumWindow.OnClose event calls TChromiumWindow.DestroyChildWindow which triggers the TChromiumWindow.OnBeforeClose event.
- TChromiumWindow.OnBeforeClose sets FCanClose to True and closes the form.
TChromiumWindow is a special component that has a slightly different destruction sequence and it's meant for quick browser implementations.
If your application creates several browsers I would recommend you to use the usual TChromium + TCEFWindowParent combination.