Page 1 of 1

CEF4Delphi and VirtualUI revisited - workaround

Posted: Tue Oct 11, 2022 7:30 am
by JanDoggen
Hello Salvador,

You have two earlier issues from people asking about using CEF4Delphi in combination with VirtualUI:
https://github.com/salvadordf/WebView4Delphi/issues/25
https://github.com/salvadordf/CEF4Delphi/issues/391

These did not result in much. I'm opening a new ticket with more info, because I have an working case with a workaround that may make a new investigation possible.
I have made a copy from the SubProcess project, renamed it SimpleBrowserForSubprocessVirtualUI, and placed it in your Delphi_VCL project folder with folder name SubProcessVirtualUI. This subfolder is attached as a ZIP file, I'm using Delphi 11 Alexandria for testing.

Essentials and observations:

- You must use the subprocess, not just SimpleBrowser(2).

- You must tell VirtualUI that it can execute the subprocess - in the FormCreate: VirtualUI.AllowExecute('SimpleBrowser_sp.exe');
The URL loads on startup but you may not immediately see it. Only when interacting with the browser window will the page initially show up (or fire a TTimer once to get it to show).

- After that it is possible to interact with the browser window, but it needs repeated clicks or mouse overs to actually do something, with delays. It is as if it 'needs repaints'. This gave me the idea of adding a TmrRepaint that does the repaint every 100 ms; if I enable that in the FormActivate 'it works' - but of course that's an ugly workaround.

- This is the with latest version 106.0.27 of CEF4Delphi and the one-but-latest version 3.1.5.103 of VirtualUI, but the timer workaround also does its thing with CEF4Delphi 84.3.10 and VirtualUI 3.0.7.107

- I also tried to adapt the SimpleBrowser(2) using the TTimer trick but failed, because the ChromiumLoadEnd() does not fire

Reason for posting this issue:
- To show you and other how it can be done with the TTimer workaround
- To ask you if you see a better way to solve it in the CEF4Dephi code; maybe the TTimer workaround points you in the direction to look at

Bye
Jan Doggen
TimeTell BV
The Netherlands

Re: CEF4Delphi and VirtualUI revisited - workaround

Posted: Fri Oct 14, 2022 5:41 pm
by salvadordf
Thank you very much for this information Jan! :D

I didn't know there was a way to allow the execution of subprocesses.

I'll try your demo over the weekend.

Re: CEF4Delphi and VirtualUI revisited - workaround

Posted: Sat Oct 15, 2022 5:33 pm
by salvadordf
I just uploaded 3 new CEF4Delphi demos to GitHub that run inside VirtualUI.

They are based on the OSR demos to make sure the browser was refreshed correctly.

Thank you again Jan! :D