|
Rank: Advanced Member Groups: Member
Joined: 4/6/2015 Posts: 33
|
We would like to run WebBrowser on a Windows Form which we can show modally (ShowDialog) and then Hide and later ShowDialog on it again.
This saves the time of having to reload the Windows Form each time.
However, after we Hide the form and go to redisplay it, we get an error that the WebView has been destroyed.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Please set the UnloadDelay property of the WebView object inside your modal form to a large value. By default when the dialog close, the Form window is destroyed. When the Form window is destroyed, all child windows are destroyed as well, and this would include the browser window except EO.WebBrowser would try to keep alive for a short time as specified by UnloadDelay. So increasing this property will keep the browser window even if the parent form window is destroyed.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 4/6/2015 Posts: 33
|
Did not work. Do I need to do something to detach the WebView from the form? I tried setting WebControl1.WebView to Null and reattaching it, but it did not help, even with UnloadDisplay of 100000.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, We tested the following code and it works fine:
Code: C#
TestForm m_Form;
void ShowTestForm()
{
if (m_Form == null)
m_Form = new TestForm();
m_Form.ShowDialog();
}
Here TestForm is a Form with a WebControl and a WebView in it. Setting UnloadDelay to that WebView to a large value would keep the WebView in memory instead of being destroyed when the parent form is destroyed. Alternatively, you can try to call "Hide" instead of "Close" when your modal form closes. This will keep the form itself alive. The root of the problem here is the parent form is destroyed but you want to keep the WebView inside it alive. If none of the above resolve the problem for you, please try to isolate the problem into a test project and send us the test project. See here for instructions: http://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 4/6/2015 Posts: 33
|
I submitted a test program some time ago. Any response?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
The workaround for this is to remove the Me.Hide calls in your code. EO.WebBrowser is optimized for parent window being destroyed, but it seems to have problem with parent window being simply invisible. When the parent window is being destroyed, EO.WebBrowser will not be destroyed immediately, instead it will stay in memory for a period of time (specified by UnloadDelay), and if it is reactivated within that period, it can position itself on screen very fast. So if the only contents in your form is the WebView, then allowing the window to close and destroy will not introduce significant performance penalty.
We do understand ideally your case should work too. As explained in the reply to your other post, we are in the process of updating our code base to Chrome 41, so once that is done we will revisit this as soon as possible.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 4/6/2015 Posts: 33
|
EO.Total_2015.1.53.2.msi seems to have fixed this problem.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Thanks for the update. We are working on the other error that you reported and will let you know as soon as we find something on that one.
|
|