Off screen pop up wrong position

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Off screen pop up wrong position

Postby Cromon » Sun Jun 10, 2018 3:47 am

Hello all

When implementing my pop up rendering I am noticing, that the combo box (select) pop up is not correctly rendered. Actually it is misplaced. You can see it in this screen shot:
https://i.imgur.com/CN2mWit.png

I first suspected a rendering error on my part, however the mouse interaction is at exactly the location of the pop up as you can see with the mouse cursor. Also If I dont use the pop up location from the callback it is exactly in the top left corner of my window. My next guess was that I am doing something wrong with the screen coordinates/view coordinates in the render handler callback, however window popups show up at the right location (which they didnt when I had implemented the callbacks from render handler wrong) as seen below:
https://i.imgur.com/pRMWiMo.png

I am taking the coordinates directly from the callback
Code: Select all
void OnPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect) override;


like this:
Code: Select all
      void PopUpDrawer::onResizePopup(const CefRect& rect) {
         mPositionX = rect.x;
         mPositionY = rect.y;
         mWidth = rect.width;
         mHeight = rect.height;
      }


Is there something I need to do with these coordinates first?

Thanks in advance and BR
Cromon
Cromon
Techie
 
Posts: 20
Joined: Sun Dec 15, 2013 9:04 am

Re: Off screen pop up wrong position

Postby salvadordf » Sun Jun 10, 2018 8:41 am

If you use a high DPI monitor check that the coordinates are converted correctly.

You also need to call browser->GetHost()->NotifyMoveOrResizeStarted(); when your app receives WM_MOVING or WM_MOVE.
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects.
User avatar
salvadordf
Expert
 
Posts: 129
Joined: Sun Dec 18, 2016 8:39 am
Location: Spain

Re: Off screen pop up wrong position

Postby Cromon » Sun Jun 10, 2018 3:48 pm

I am using high dpi. What coordinates do you mean? The window seems exactly 1.5 times off, which is the scale I am having, however the mouse cursor is currently correctly interacting with the popup. This means its actually displayed in the wrong position. I get the feeling that just calling the high dpi aware function is not enough. What needs to be converted in case of high dpi awareness?
Cromon
Techie
 
Posts: 20
Joined: Sun Dec 15, 2013 9:04 am

Re: Off screen pop up wrong position

Postby amaitland » Sun Jun 10, 2018 5:47 pm

You can look at the cefclient source for a reference implementation.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Off screen pop up wrong position

Postby Cromon » Mon Jun 11, 2018 2:09 am

Thank you for the info. I think i know now where to look. Until your comment I assumed the cefclient is gone and it now took me like 20 minutes to figure out it is in the test folder :)
Cromon
Techie
 
Posts: 20
Joined: Sun Dec 15, 2013 9:04 am

Re: Off screen pop up wrong position

Postby Cromon » Mon Jun 11, 2018 11:24 am

Perfect, everything else now also is properly scaled :)

https://i.imgur.com/HIecZnS.png
Cromon
Techie
 
Posts: 20
Joined: Sun Dec 15, 2013 9:04 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 113 guests