|
Rank: Member Groups: Member
Joined: 5/15/2022 Posts: 10
|
To solve this problem I did the following.
1. Click on Form1.cs Designer
2, Clicked webView1 and looked at properties on the right side of the screen.
3. Clicked on The Events icon.
4. Scrolled down to NewWindow and clicked on NewWindow text on left side then I hit menu selection and selected
webView1_NewWindow
5. that method was added and I typed the following in the method:
webcontrol1.WebView.Url = e.TargetUrl;
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, The steps you provided is not the "normal" way of handling this event. The "normal" way (to allow the popup to show) should be something like this:
Code: C#
//Step 1:
//Create a new Form with a blank WebControl
//This new Form is the popup window
Form form1 = new Form();
EO.WinForm.WebControl webControl = new EO.WinForm.WebControl();
webControl.Dock = DockStyle.Fill;
form1.Controls.Add(webControl);
//Step 2:
//Put the new WebView (created by the browser engine)
//in the new blank WebControl
webControl.WebView = e.WebView;
//Step 3:
//Display the new Form
form1.Show();
//Step 4:
//Notify the browser engine that you "accept" (and display)
//the popup
e.Accepted = true;
You should not change step 2 and step 4. However you can customize step 1 and step 3 however you wanted. For example, the above code creates a new top level form and put the WebView inside that Form. You may want to create a tab in a TabStrip instead. You could also put it inside one of your existing Form (for example, your main WebView on the left, "popup" WebView on the right). This part is completely up to you. Hope this helps. Thanks
|
|
Rank: Member Groups: Member
Joined: 5/15/2022 Posts: 10
|
Hi, thanks so much for your quick response. I will try this and post back how it worked. Thanks a lot.
Derrick
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
You are very welcome. Please feel free to let us know if there is anything else.
|
|
Rank: Member Groups: Member
Joined: 5/15/2022 Posts: 10
|
I used your code and it worked great. Thank you Essential Objects!!!!
|
|