I can't resize popup page. Could you advice to me something?

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.

I can't resize popup page. Could you advice to me something?

Postby mung » Wed Oct 24, 2018 2:58 am

Hi ~

window7, CEF cef_binary_3.3440.1806.g65046b7_windows64, with osr_mode.
and I tried cef_binary_3.3497.1841.g7f37a0a_windows64_client sample too.

I can't resize that is a popped up window.

When I tried in Chrome it does work well.
However, when I tried in cef_binary_3.3440.1806.g65046b7_windows64 and cef_binary_3.3497.1841.g7f37a0a_windows64_client.
It didn't work resize.

I can't attach sample HTML files. so I will write the HTML code.


test.html
Code: Select all
<button onclick=window.open("./popup.html","","height=200,width=200")>Test</button>


popup.html
Code: Select all
<script>
window.resizeTo(400, 200);
function Test1()
{
    window.resizeTo(600, 300);
}
function Test2()
{
    window.resizeTo(300, 600);
}
</script>
test1111
<button onclick=Test1()>Test1</button>
<button onclick=Test2()>Test2</button>


(1, test.html file is the main page.
2, When clicking the test button in the test.html, you can see the popup.html, and you can see the two buttons Test1, Test2 in the popup.html page.
3, When you clicking the Test1, Test2, button execute resize window size function.)


You can try the problem.

Could you advise how to solve the problem?

Thank you.
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Re: I can't resize popup page. Could you advice to me someth

Postby Czarek » Wed Oct 24, 2018 3:20 am

Related issue: https://bitbucket.org/chromiumembedded/cef/issues/698

You can override "window.resizeTo" using javascript bindings and implement it in C++.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: I can't resize popup page. Could you advice to me someth

Postby mung » Wed Oct 24, 2018 8:12 am

Czarek wrote:Related issue: https://bitbucket.org/chromiumembedded/cef/issues/698

You can override "window.resizeTo" using javascript bindings and implement it in C++.


Thank you for your answer.

I have two question.

Can I bind "window.resizeTo" javascript function in c++?

I found this page "https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md#markdown-header-functions-and-window-binding".


The First question, The meaning you said I have to use a custom function? or I can bind "window.resizeTo" javascript function?
Second question, If I bind the function "window.resizeTo", then how to set to the size of a popped-up window.

Could you explain more detail about how to bind "window.resizeTo" javascript function in c++?

Thank you.
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Re: I can't resize popup page. Could you advice to me someth

Postby Czarek » Wed Oct 24, 2018 10:56 am

In the code you reference from the wiki page, just replace "myfunc" with "resizeTo". Call CefBrowserHost::GetWindowHandle to obtain window handle and then call OS native function SetWindowPos to set window size, see: https://docs.microsoft.com/en-us/window ... twindowpos .
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: I can't resize popup page. Could you advice to me someth

Postby mung » Wed Oct 24, 2018 8:54 pm

Czarek wrote:In the code you reference from the wiki page, just replace "myfunc" with "resizeTo". Call CefBrowserHost::GetWindowHandle to obtain window handle and then call OS native function SetWindowPos to set window size, see: https://docs.microsoft.com/en-us/window ... twindowpos .


Thank you for your answer :)

I understood almost about you said.

I will bind "resizeTo" function instead of "myfunc" in the referenced wiki page.

And, I tried to use SetWindowPos function, However, I don't know how to get HWND of the popped-up window.

Where can I get the HWND of the popped-up window?

The popped-up window was I didn't make that.
The popped-up window was made in CEF.

I'm using SubProcess.exe. and multithread-message-loop.

Sorry, Could you help me a little more?

Thank you :)
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Re: I can't resize popup page. Could you advice to me someth

Postby mung » Wed Oct 24, 2018 9:00 pm

Czarek wrote:In the code you reference from the wiki page, just replace "myfunc" with "resizeTo". Call CefBrowserHost::GetWindowHandle to obtain window handle and then call OS native function SetWindowPos to set window size, see: https://docs.microsoft.com/en-us/window ... twindowpos .


Ah! I'm sorry.

I notice now the function in your answer.

Thank you I will try that.
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 107 guests