CEF drag handler?

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

CEF drag handler?

Postby Gandalf » Fri Mar 30, 2018 11:07 am

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 ~
Gandalf
Newbie
 
Posts: 5
Joined: Fri Mar 30, 2018 7:33 am

Re: CEF drag handler?

Postby Gandalf » Fri Mar 30, 2018 11:50 am

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?
Gandalf
Newbie
 
Posts: 5
Joined: Fri Mar 30, 2018 7:33 am

Re: CEF drag handler?

Postby magreenblatt » Fri Mar 30, 2018 12:09 pm

Implement CefDragHandler and return via CefClient::GetDragHandler.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CEF drag handler?

Postby Gandalf » Fri Mar 30, 2018 1:30 pm

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?
Gandalf
Newbie
 
Posts: 5
Joined: Fri Mar 30, 2018 7:33 am

Re: CEF drag handler?

Postby magreenblatt » Fri Mar 30, 2018 9:05 pm

There is an example implementation in cefclient.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 24 guests