Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The popup window and parent window can't script each other in the wxpython.py example #171

Open
GoogleCodeExporter opened this issue Aug 6, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

The keyboard problems in popup windows in wxPython (Issue 80) were fixed by 
implementing LifespanHandler.OnBeforePopup. The creation of popup window by CEF 
is cancelled and popup browser is created on our own. The implication of this 
is that the popup window and parent window can't script each other. The 
"window.opener" is not available in the popup browser.

I think we might be able to fix this by modifying the OnBeforePopup 
implementation to this:

1. Create wx.Frame, but do not embed browser in it
2. Use the windowInfo argument to call windowInfo.SetAsChild with the wx.Frame 
handle

This way we take care of creating the window itself, by leave teh embedding of 
the browser to CEF. I think this could fix the popup<>parent scripting issues.

However, OnBeforePopup runs on the IO thread and wx.Frame window creation must 
run on the UI thread. So it must wait in the OnBeforePopup until the window is 
created. How can to accomplish that? How to pause the execution on the IO 
thread and return window handle back from the the UI thread to the IO thread?

Original issue reported on code.google.com by czarek.t...@gmail.com on 23 Jan 2015 at 11:41

@GoogleCodeExporter
Copy link
Author

Created topic on the CEF Forum for this issue: 
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=12596

Original comment by czarek.t...@gmail.com on 23 Jan 2015 at 7:46

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

There is a solution for this issue, Marshall provided the idea:

  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.

I think this should be implemented only in wxadvanced.py and in cefpython3.wx, 
as it complicates things a bit. In wxsimple.py just provide a comment about 
keyboard issues in popups and the fix.

Original comment by czarek.t...@gmail.com on 23 Jan 2015 at 7:56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant