Page 1 of 1

CEF drag handler?

PostPosted: Fri Mar 30, 2018 11:07 am
by Gandalf
Hi

Is there possibly a clean and simple example of implementing a draggable region with CEF 3 (C++)? I cannot find that much on it but anything I can find happens to be quite messy and or unclear... I am left not able to understand how to go about implementing it. Sadly the docs on the BitBucket page does not have a section dedicated to this feature.

I am trying to make a movable window. I've removed the Win32 title-bar and re-made my own equivalent on the browser document, now all I need to do is support moving the window by dragging on the HTML container. I used to use a method which involved a call to ReleaseCapture and SendMessage but this no longer works when using CEF (e.g. JavaScript back to C++ with the V8 handler support for the on-drag event) and I have also tried sub-classing the browser window to handle a message and return HTCLIENT for WM_NCHITTEST but this did nothing.

What is the best way to accomplish this and is there any good example/documentation for achieving this?

~ Thank you ~

Re: CEF drag handler?

PostPosted: Fri Mar 30, 2018 11:50 am
by Gandalf
I have just done an override for OnDraggableRegionsChanged in CEF 3 (C++). I have also set the CSS styling of a section in HTML as drag for -webkit-app-region.

How do I get the override function called though? With some others there is an override to return the object... But I cannot find one like that for OnDraggableRegionsChanged so how would I notify CEF to look at it?

Re: CEF drag handler?

PostPosted: Fri Mar 30, 2018 12:09 pm
by magreenblatt
Implement CefDragHandler and return via CefClient::GetDragHandler.

Re: CEF drag handler?

PostPosted: Fri Mar 30, 2018 1:30 pm
by Gandalf
Thank you very much.

I did as you said and the OnDraggableRegionsChanged function is now being used by CEF 3.

Is there a page anywhere explaining what you should do in this function to set everything up?

Re: CEF drag handler?

PostPosted: Fri Mar 30, 2018 9:05 pm
by magreenblatt
There is an example implementation in cefclient.