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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Setting Parent nil closes Form/App

Post Reply
RaelB
Posts: 26
Joined: Sun Feb 12, 2017 11:22 am

Setting Parent nil closes Form/App

Post by RaelB »

Hi,
I made a small modification to SimpleBrowser2, i.e. placed CEFWindowParent1 on a Panel (Panel1)

Calling:
Panel1.Parent := nil
or
CEFWindowParent1.Parent := nil
or
Panel1.Parent := Panel3

all result in FormCloseQuery being called (i.e. sends WM_CLOSE), and so the app exits.

Is it possible to do any of the above, without the app closing?

I want to be able to show/hide, or remove (i.e. set Parent nil) and then replace (i.e. set Parent to existing panel) the CEFWindowParent.
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Setting Parent nil closes Form/App

Post by salvadordf »

Hi,

The VCL might be calling recreatewnd when you set the parent to nil and the child browser thinks the application is closing.

Call TChromiumCore.SetNewBrowserParent to reparent the browser to a different TCEFWindowParent.
Post Reply