OnBeforePopup and parent/popup scripting issues

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.

OnBeforePopup and parent/popup scripting issues

Postby Czarek » Fri Jan 23, 2015 2:45 pm

When using wxPython GUI toolkit there is a problem with keyboard not working in popup windows, the CHAR events for inputs are not propagated. I have resolved this by implementing OnBeforePopup and creating the window on my own using wx. The problem is that the popup window and parent window are not able to script each other. So I'm thinking on a different fix, to implement OnBeforePopup, but with window creation being delegated to wx and browser embedding being delegated to CEF. I think this could be done by using the windowInfo parameter passed to OnBeforePopup. First the window would be created by wx and then I would call windowInfo.SetAsChild and pass the window handle. But how can I do that? The OnBeforePopup is being called on the IO thread and the window must be created on the UI thread. I can use the CefPostTask to delegate window creation to the UI thread, but how can I lock the IO thread for that time and get the widow handle from the UI thread?

Any ideas appreciated, thanks.
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: OnBeforePopup and parent/popup scripting issues

Postby magreenblatt » Fri Jan 23, 2015 2:49 pm

Czarek wrote:First the window would be created by wx and then I would call windowInfo.SetAsChild and pass the window handle. But how can I do that?

Create a hidden window when your application starts. Parent the new popup browser to the hidden window in OnBeforePopup. After the browser exists (OnAfterCreated) create the desired target window and re-parent the browser to that target window.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: OnBeforePopup and parent/popup scripting issues

Postby Czarek » Fri Jan 23, 2015 2:51 pm

magreenblatt wrote:
Czarek wrote:First the window would be created by wx and then I would call windowInfo.SetAsChild and pass the window handle. But how can I do that?

Create a hidden window when your application starts. Parent the new popup browser to the hidden window in OnBeforePopup. After the browser exists (OnAfterCreated) create the desired target window and re-parent the browser to that target window.

That should work, much thanks :)
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


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 89 guests