Welcome Guest Search | Active Topics | Sign In | Register

Is it possible to assign a form.close event to an existing button on a webpage created by a WebView? Options
KimKamp
Posted: Monday, March 13, 2017 3:26:24 PM
Rank: Advanced Member
Groups: Member

Joined: 3/13/2017
Posts: 33
I'm using the EO.WebBrowser component, and I am able to open a new vb.net Form using a WebView.NewWindow event.

On the form page, there is a 'Print' button and a 'Close' button. The Print button will print the page, but the Close button just clears out all of the data on the page, and leaves the Form open.

I'd like to be able to assign a "Me.Close" event to the existing Close button. Is it possible to do that? If so, how?

Thanks!


Kim
eo_support
Posted: Monday, March 13, 2017 4:41:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You would handle the WebView's Closed event and then inside that event handler to call Close method on the form.

Thanks!
KimKamp
Posted: Thursday, March 16, 2017 1:42:01 PM
Rank: Advanced Member
Groups: Member

Joined: 3/13/2017
Posts: 33
Thanks for the reply.

What I want to do is know the name of the Button in the WebView that has been clicked.

I am working with a Print window, where there is a 'Print' button and a 'Cancel' button. The Print button works fine, but the Cancel button is not working correctly.

The issue is that, when I click a "Cancel" button in a WebView, it clears all of the information off the WebView, leaving a blank screen, but it does not close the Form that the WebView is in.

How do I capture the name of the button that has been clicked in a WebView?
eo_support
Posted: Thursday, March 16, 2017 2:42:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You do not need to capture the name of the button clicked. The flow of events is:

1. You click "Cancel" button;
2. The JavaScript code in the page that handles the cancel button calls window.close;
3. The WebView is closed (this is why you see a blank screen);
4. The WebView's Closed event is triggered;
5. Inside your WebView's Closed event handler, you close the form;

The event flow will differ for the Print button from step 2 since you are not calling window.close in your print button's click handler.

Does this make sense to you?

Thanks
KimKamp
Posted: Thursday, March 16, 2017 10:18:48 PM
Rank: Advanced Member
Groups: Member

Joined: 3/13/2017
Posts: 33
Hi. Yes, it does make sense. I was not closing the Form when the Webview was closing. I wrote code in the Closing event to close the Form, and all is well. Thanks!
eo_support
Posted: Friday, March 17, 2017 7:43:11 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Great! Glad to hear that it works for you now.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.