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 create and destroy browser form?
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
How to create and destroy browser form?
Hello.
I have 2 forms in a project. Main form contains a lot of buttons and functions. The second form contains TChromium component.
A button on the main form should show (create/activate) 2nd form with TChromium, make some action and close (hide/destroy) form with TChromium after everything is done or timeout and free memory.
The next time the button should create form once again. And again and again.
I am not able to do it myself. Demos did not make it clear. Please help me.
I have 2 forms in a project. Main form contains a lot of buttons and functions. The second form contains TChromium component.
A button on the main form should show (create/activate) 2nd form with TChromium, make some action and close (hide/destroy) form with TChromium after everything is done or timeout and free memory.
The next time the button should create form once again. And again and again.
I am not able to do it myself. Demos did not make it clear. Please help me.
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to create and destroy browser form?
Use the code in the ToolboxBrowser demo.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to create and destroy browser form?
I use old version - 'Delphi Chromium Embeded 3'. I found ToolBoxBrowser on github.
There is an error Unit uCEFApplication not found
CreateGlobalCEFApp;
if GlobalCEFApp.StartMainProcess then
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end;
DestroyGlobalCEFApp;
Last edited by andreykrasnodar on Fri Jul 03, 2020 9:53 am, edited 1 time in total.
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to create and destroy browser form?
Check that CEF4Delphi's source directory is in the Delphi's library path :
https://www.briskbard.com/index.php?lan ... stallation
https://github.com/salvadordf/CEF4Delph ... -in-Delphi
https://www.briskbard.com/index.php?lan ... stallation
https://github.com/salvadordf/CEF4Delph ... -in-Delphi
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to create and destroy browser form?
Of course it is in the Delphi's library path. But there is no uCEFApplication in itsalvadordf wrote: Fri Jul 03, 2020 9:47 am Check that CEF4Delphi's source directory is in the Delphi's library path :
https://www.briskbard.com/index.php?lan ... stallation
https://github.com/salvadordf/CEF4Delph ... -in-Delphi
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to create and destroy browser form?
You should have this file in the "CEF4Delphi\source" directory :
https://github.com/salvadordf/CEF4Delph ... cation.pas
"CEF4Delphi\source" should also be added to the library path for 32 bits projects and 64 bits projects in the Delphi configuration window.
This is a common issue in Delphi because the configuration window shows the library path for 64 bits projects by default and most of the demos have a 32 bit target by default.
https://github.com/salvadordf/CEF4Delph ... cation.pas
"CEF4Delphi\source" should also be added to the library path for 32 bits projects and 64 bits projects in the Delphi configuration window.
This is a common issue in Delphi because the configuration window shows the library path for 64 bits projects by default and most of the demos have a 32 bit target by default.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to create and destroy browser form?
But I use Cef 3 (old version) https://github.com/hgourvest/dcef3 . I need it to create project for Windows XP.salvadordf wrote: Fri Jul 03, 2020 10:22 am You should have this file in the "CEF4Delphi\source" directory
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to create and destroy browser form?
I used simple code
But after terminating the application it is still in task manager and eats my memory.
Code: Select all
Form1.Show;
Form1.Delay(5000);// my own procedure like sleep(), but does not load processor
form1.Chromium1.Load('yandex.ru');
Form1.Delay(100000);
form1.Chromium1.Load('about:blank');
Form1.Delay(10000);
Application.Terminate;
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to create and destroy browser form?
I'm sorry I missed that.
Consider using OldCEF4Delphi if you need to support Windows XP :
https://github.com/salvadordf/OldCEF4Delphi
It also has a ToolboxBrowser demo.
Consider using OldCEF4Delphi if you need to support Windows XP :
https://github.com/salvadordf/OldCEF4Delphi
It also has a ToolboxBrowser demo.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to create and destroy browser form?
Thanks. But... can I do that with cef3?salvadordf wrote: Fri Jul 03, 2020 10:58 am I'm sorry I missed that.
Consider using OldCEF4Delphi if you need to support Windows XP :
https://github.com/salvadordf/OldCEF4Delphi
It also has a ToolboxBrowser demo.