View Full Version : Responding to Scrolling HTML links.
jassing
09-16-2008, 12:45 PM
I have a scrolling html screen. in it is a hyperlink; who's target frame is _blank
I want to close down the true update screen when the hperlink is clicked.
if e_CtrlID == CTRL_SCROLLTEXT_BODY and e_MsgID == MSGID_ONNAVIGATE then
Application.Exit(0);
end
But OnCtrlMessage does not get fired when you double click on the hyperlink.... (which, by the way, does open a page...)
upeters
09-16-2008, 04:08 PM
Hi Josh,
this works fine for me here. Using your code in On Ctrl Message of a Scrolling HTML dialog does indeed shut down my updater, as expected. I was not able to double click, as my first click already hides the dialog. I am using version 3.0.1.0.
Ulrich
jassing
09-16-2008, 04:25 PM
Hi Josh,
this works fine for me here. Using your code in On Ctrl Message of a Scrolling HTML dialog does indeed shut down my updater, as expected. I was not able to double click, as my first click already hides the dialog. I am using version 3.0.1.0.
Ulrich
Thanks Ulrich.
Was your hyperlink targeted to _blank?
upeters
09-16-2008, 04:34 PM
Thanks Ulrich.
Was your hyperlink targeted to _blank?
Oops. I have no target for that link. If a target is set, then the click event is ignored, which is kind of expected because the navigation happens in a new instance, not in the current one. There is no "On Navigate" event happening in the current browser, and no event can be fired. If, however, you set the target to "_self", or have no target at all, it works.
Ulrich
jassing
09-16-2008, 04:47 PM
Oops. I have no target for that link. If a target is set, then the click event is ignored, which is kind of expected because the navigation happens in a new instance, not in the current one. There is no "On Navigate" event happening in the current browser, and no event can be fired. If, however, you set the target to "_self", or have no target at all, it works.
Ulrich
I would disagree -- the navigation IS happening; it's happening away from the current link in a new window -- regardless of where; the navigation is happening.... This would make complete sense if the message was "OnPageContentsChange" but it's OnNavigate; and it is...
Got any thoughts on how to work around it? My only thought it is to have a refresh page that gets clicked; on it's load opens a new page in a new window; triggers the pagecontent change; then issues a "back"...
but that doesn't make me happy...
upeters
09-16-2008, 05:11 PM
I understand, but it seems that in this case a "DWebBrowserEvents::NavigateComplete Event" isn't fired. To get what you want, you would probably need to intercept the "DWebBrowserEvents::NewWindow Event", which occurs when you create a new WebBrowser or Internet Explorer object, but it wasn't implemented in that web control we have today.
In your case, upon clicking the link you want to open the web page and shut down the updater. Unless I am missing something, why don't you simply perform this directly in the script? Place no target on your hyperlink at all, and make a On Ctrl Message handler it work like this:
if (e_CtrlID == CTRL_SCROLLTEXT_BODY and e_MsgID == MSGID_ONNAVIGATE) then
Shell.Execute(e_Details.URL, "open", "", "", SW_SHOWNORMAL);
Application.Exit(0);
end
You can even make this behave for a specific link only, not closing the updater for others.
Ulrich
jassing
09-16-2008, 05:15 PM
I understand, but it seems that in this case a "DWebBrowserEvents::NavigateComplete Event" isn't fired. To get what you want, you would probably need to intercept the "DWebBrowserEvents::NewWindow Event", which occurs when you create a new WebBrowser or Internet Explorer object, but it wasn't implemented in that web control we have today.
In your case, upon clicking the link you want to open the web page and shut down the updater. Unless I am missing something, why don't you simply perform this directly in the script? Place no target on your hyperlink at all, and make a On Ctrl Message handler it work like this:
if (e_CtrlID == CTRL_SCROLLTEXT_BODY and e_MsgID == MSGID_ONNAVIGATE) then
Shell.Execute(e_Details.URL, "open", "", "", SW_SHOWNORMAL);
Application.Exit(0);
end
You can even make this behave for a specific link only, not closing the updater for others.
Ulrich
On win2008 this ( I recall, but will test again) pops up a message "do you want to open ...." which just confuses the user even more...
thank -- I'll give it a try to confirm that my recollection is accurate.
jassing
09-16-2008, 05:28 PM
Brilliant! Thank you Ulrich for the suggestion... indeed; my memory was faulty; win2008 didn't ask. I imagine vista will; but for now; I'm not worried about vista...
Thanks
-josh
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.