Page 1 of 1

Waiting message.

Posted: Thu Mar 12, 2020 6:16 pm
by Djota
Hi.

well, i took the simplebrowser demo and put a panel with a message please wait and make it visible in the chromium OnLoadStart event and make it invisible in OnLoadEnd.
Problem that after I did that, when I close the browser executable, it gives a memory error.

---------------------------
Chromesgdw
---------------------------
Access violation at address 005E3FEB in module 'ChromeSGDW.exe'. Read of address 00000010.
---------------------------
OK
---------------------------


and if I don't leave the panel visible, the error doesn't happen.

Re: Waiting message.

Posted: Thu Mar 12, 2020 6:20 pm
by salvadordf
Hi,

TChromium events are executed in CEF threads and it's not safe to create/destroy/modify VCL controls in any other thread different than the main application thread.

Send windows messages from those events to the form in order to show and hide the panel in the main application thread.

Re: Waiting message.

Posted: Thu Mar 12, 2020 6:27 pm
by Djota
Would you have an example to show?

Re: Waiting message.

Posted: Thu Mar 12, 2020 6:35 pm
by salvadordf
Many demos send a CEF_AFTERCREATED message from the TChromium.OnAfterCreated event to the form because they usually set a caption and enable some parts of the interface:
https://github.com/salvadordf/CEF4Delph ... r.pas#L237

https://github.com/salvadordf/CEF4Delph ... r.pas#L505

Re: Waiting message.

Posted: Thu Mar 12, 2020 6:38 pm
by Djota
Thank you very much for the agility