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.
4. Run app
5. Load http://mymoney.su
6. Click the button - Page scrolls
7. Click on menu link on the site.
8. Click the button - Page NOT scrolls. Why? if you spin the wheel of a real mouse, then the scroll will work by the button
Each time you click on a control the browser loses the focus and that button is simulating a mouse event over a browser without focus.
Besides that, the browser captures the mouse to scroll the whole page or the contents of the element under the mouse pointer. I'm not sure what could happen if the browser gets conflicting information when the user clicks on an element and then receives a mouse event from a point outside that element.
If that CEF function is not 100% reliable I would try this :
Use JavaScript functions like window.scrollBy instead of the CEF functions.
Send WM_MOUSEWHEEL messages to TChromium.RenderHandle
Use a browser in OSR mode to simulate full keyboard and mouse events.
salvadordf wrote: Wed Feb 19, 2020 9:20 am
Each time you click on a control the browser loses the focus and that button is simulating a mouse event over a browser without focus.
But the first time the scroll works. Only after clicking on the link stops.
salvadordf wrote: Wed Feb 19, 2020 9:20 am
If that CEF function is not 100% reliable I would try this :
Use JavaScript functions like window.scrollBy instead of the CEF functions.
Send WM_MOUSEWHEEL messages to TChromium.RenderHandle
Use a browser in OSR mode to simulate full keyboard and mouse events.
The GlobalCEFApp.SmoothScrolling needs to be set before the GlobalCEFApp.StartMainProcess call in the DPR file.
Build the SimpleOSRBrowser demo with the GlobalCEFApp.SmoothScrolling property and without it. Run them side by side and you'll notice that the scroll is smoother in one of them.
That error code appears when a control handle has been created and destroyed in different threads.
Don't create, destroy or modify VCL controls inside the CEF events because most of them are executed in CEF threads. Some VCL controls will recreate handles when you try to modify them and this can be problematic if you do it inside CEF events.
The CEF4Delphi demos try to be as simple and easy as possible and they often don't follow that rule.