I did a quick test modifying the SimpleBrowser2 to include 2 frames, each with a panel and a CEFWindowParent.
The structure would be like this :
- Frame1 -> Panel -> CEFWindowParent1
- Frame2 -> Panel -> CEFWindowParent2
I also added 2 buttons :
- Button1 : Calls SetNewBrowserParent to switch the browser parent between CEFWindowParent1 and CEFWindowParent2.
- Button2 : Sets Frame1.parent to a different component.
If I click Button2 while CEFWindowParent1 is the browser parent causes problems. I'm not sure if Delphi destroys CEFWindowParent1 or recreates its handle.
SimpleBrowser2 still has the code to close the app correctly following the destruction sequence and the CEFWindowParent1 destruction triggers TChromium.BeforeClose, closing the application.
This can be avoided following these steps :
- First click Button1 to set CEFWindowParent2 as the new browser parent.
- Then click Button2 to set the new Frame1 parent.
- Then click Button1 again to set CEFWindowParent1 as the browser parent.