Reputation: 4220
I'm using the Off-screen rendering component TChromiumOSR
in the dcef3 package - the Delphi wrapper for Chromium-embedded
library.
FormA
contains a TChromiumOSR
and paints the output.
Modal FormB
modifies the web page by executing some js
code against FormA.TChromiumOSR
.
The TChromiumOSR.OnPaint
event (in FormA
) is not triggered until FormB.ShowModal
returns.
TChromium
control.I assume the `TForm.ShowModal' method only blocks the input of the background forms, but not the painting?
Or does it caused by the internal working of cef3?
Anyway, how to solve it? Thanks.
Upvotes: 0
Views: 612
Reputation: 4220
Ok, I found the source of the problem - it's not a bug in cef3 or dcef3 but was caused by my improper use of Delphi Event Bus, and the following are the steps to reproduce the issue:
js
code to update the web page inside dcef3
, which in turn will trigger some of the dcef3
events (in the main thread), and here is where the program stuck - since the TEventBus.Post()
method is locked by a TCriticalSection
.Solution:
In Step #1, don't call ShowModal
directly, but use a technique such as PostMessage
winapi to 'delay' the execution of ShowModal
.
I'm not sure if I have described it clearly...
Upvotes: 0
Reputation: 7912
I've succeeded updating an HTML element by using the ExecuteJavaScript method called from a modal form. But you might have use CEF V8 as well (that's what I haven't tested). For cases when you need to invalidate the current view manually, you can call Invalidate:
MyChromiumOSR.Browser.Host.Invalidate(PET_VIEW);
But that's workaround rather than solution. Invalidating of relevant elements should happen by the CEF engine for you. And if you come up with an MCVE, I can investigate more about your specific problem.
Upvotes: 1