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

ViewController not visible after change parent of owner control #2070

Open
amancini opened this issue Jan 10, 2022 · 6 comments
Open

ViewController not visible after change parent of owner control #2070

amancini opened this issue Jan 10, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@amancini
Copy link

Hello,
when I change the parent of the form that contains the WebView2 the ViewController goes into invisible state.
Even calling Put_IsVisible to true or trying to re-assign the parent with Put_ParentWindow the problem is not solved

the environment used is Delphi (Embarcadero) and when you change a parent all the handles of the children are recreated.

to date the only workaround I have found is to re-create the webView, but in this case I lose all the various operations done on the previously loaded page ...

I am using the latest version of WebView2Loader.dll [1.0.1083.0] and the latest WebView2 Runtime [97.0.1072.55]

Best regards

@amancini amancini added the bug Something isn't working label Jan 10, 2022
@champnic
Copy link
Member

Hey @amancini - I'm unfamiliar with using WebView2 in Delphi, but if it's recreating all of the window handles then it's possible that's screwing up the WebView2 part of the tree. If you wanted to, could you try removing the WebView2 from the tree temporarily, allow Delphi to do the change parent operation, and then insert the WebView2 back into the tree?

@champnic champnic self-assigned this Jan 11, 2022
@amancini
Copy link
Author

Hello @champnic , yes i used this workaround for work with WebView2 when change the parent, and it work; but why not working Put_ParentWindow after the creation of new handles ?

@champnic
Copy link
Member

You should be able to change the parent generally speaking, but it's possible that Delphi environment is doing something to the WebView2 HWNDs further down the tree (below the "parent" level) that is screwing them up.

@amancini
Copy link
Author

ok ... but with the old WebView (WebBrowser) I don't have these problems and a parent handle change shouldn't break the tree

@champnic
Copy link
Member

The new WebView2 control is very different from the old WebBrowser control, both in abilities and architecture. There will naturally be different behaviors and issues that stems from these changes.

Do you have a sample app that repros the issue that we could take a look at?

@amancini
Copy link
Author

yes I have attached the changes to the demo project of the library used to use the webView2 on delphi

I am attaching the issue of github
salvadordf/WebView4Delphi#13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants