getting browser width and height from CefBrowser object

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

getting browser width and height from CefBrowser object

Postby JohnConnor » Tue Jul 25, 2017 2:42 am

Hello,

is there an easy way of getting the browser width and height from the cefBrowser?
The thing I am trying to achieve is set the same window size for popups as the window which created it. For example my main window is 800x600 and when I click on the link - new popup shows up, but the size is not the same as of parent window. I have overridden the OnBeforePopup method in CefLifespanHandler and I need to check if the value of window being created is really the same. I would prefer to do it in CefLifespanhandler::OnAfterCreated - but it only carries the CefBrowser.
Any thoughts on this for how could I get the window width and height of windows being created?

The idea I had was to get the opener window handle by calling GetOpenerWindowHandle() on cefBrowser object of popup window. The to use this somehow and get the cefWindowInfo of the parent window. From CefWindowInfo I could get the width and height - but the question here would be - is it possible to get the windowInfo?
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am

Re: getting browser width and height from CefBrowser object

Postby Matteog » Thu Jul 30, 2020 2:12 am

Hi

I have a similar problem, i want to save popup dimensions and position in OnBeforeClose so i can restore it next time.

Any ideas?

thanks
Matteog
Newbie
 
Posts: 1
Joined: Thu Jul 30, 2020 2:08 am

Re: getting browser width and height from CefBrowser object

Postby fddima » Fri Jul 31, 2020 12:04 am

With window handle in your hands you are free to do whatever what system allow. E.g. on windows simple Get/SetWindowPos will work (but dont forget notify browser after changing window position).
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 16 guests