Page 1 of 1

add scroll function

PostPosted: Wed May 31, 2017 3:58 pm
by AndyB
I have implemented touch scroll for WPF version of CefSharp.
My first attempt was to use SendMouseWheelEvent, but this stops working at some point after navigation, click on buttons, select item in dropdown....
I generally use now javascript window.scrollBy() function. Mostly it works fine, but with some websites not, for ex.: https://www13.state.nj.us/DataMiner
The scrollbar is displayed and i can manually scroll, also touch scroll works in cefclient.exe... but scrollBy has no effect, SendMouseWheelEvent also does not work.
The scrollBy function does not work in IE, FireFox and Chrome for this sample website. I guess they have some javascript hack or strange CSS styles which makes the srollBy function not working.

scrollBy does not work at all when a PDF is displayed, SendMouseWheelEvent scrolls the PDF down, but not up.

It would be great if you can add a scroll method to CEF.

Re: add scroll function

PostPosted: Wed May 31, 2017 4:30 pm
by magreenblatt
Have you tried sending windows scroll events to the browser window handle? E.g WM_VSCROLL.

Re: add scroll function

PostPosted: Wed May 31, 2017 5:19 pm
by amaitland
There is already an open PR that will provide touch scrolling functions.

https://bitbucket.org/chromiumembedded/ ... quests/104

Re: add scroll function

PostPosted: Thu Jun 01, 2017 2:25 pm
by AndyB
magreenblatt: Thank you for your quick response and your hint!

The WPF control uses the offscreen version.
Sending WM_VSCROLL does not work. I can send messages only to the main window, not to controls. Also, i think i cannot specify pixels for WM_VSCROLL.
And the WM_VSCROLL would need to get processed by the CefSharp WPF control.

I think i solved my problem with the sample site.
I have set 0 as X and Y mouse position for the SendMouseWheelEvent. This works on most sites, but for some reason i need to set for ex 300,300 to make it working with the sample site.

But now i still have the problem that SendMouseWheelEvent stops working at some point after navigating, clicking, scrolling around.
It happens on a Microsoft Surface ProTablet. Maybe on any Windows Tablet, maybe only on tablets with High DPI.
amaitland: Can you check this when i send you a sample VB.NET project and tell you how to re-produce the issue?

I found a few posts about Touch support for WPF/Offscreen from 2014 and later, most with comments "just use WinForms".
I don't wanted to wait for "maybe works some day".
I tried WinForms with WindowsFormsHost, but this worked not in my app, my app was freezing very often.

Re: add scroll function

PostPosted: Sun Aug 19, 2018 10:43 pm
by rdi
I updated CEF in my application and encountered the same issue: after navigating across a couple pages, the scroll just stops working. Pressing Page Up/Down on the keyboard or scrolling with the scroll bars works. Only:

Code: Select all
browser->GetHost()->SendMouseWheelEvent(MOUSE_EVENT_SCROLL, scrollX, scrollY);


stops. Any suggestions welcome.

Re: add scroll function

PostPosted: Sun Aug 19, 2018 10:54 pm
by amaitland

Re: add scroll function

PostPosted: Sun Aug 19, 2018 11:38 pm
by rdi
Thanks.