Accessing a specific URL from within the code

Discussions related to Visual Prolog
Frank
Posts: 22
Joined: 23 Nov 2014 20:41

Accessing a specific URL from within the code

Unread post by Frank » 20 Feb 2017 5:30

Hello,
Environment VP 7.4 Commercial Edition.
I am trying to access an specific URL www.abc.com from within a dialog box when someone clicks on the cancel button. I am using the following code inside the program :

Code: Select all

... predicates     onCancelClick : button::clickResponder. clauses     onCancelClick(_Source ) = button::defaultAction:-       URL = "www.abc.com",     cancel_ctl:navigate(URL). ...
When I compile I get an error message: undeclared identifier ' navigate/1'

I would appreciate any feedback.

Thanks,
Frank

User avatar
Thomas Linder Puls
VIP Member
Posts: 1168
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 21 Feb 2017 8:49

A button is a user interface element that can basically receive clicks, to "access a URL" you will need something that can do that.

It is however not clear what you mean by "access a URL". Should it open in an external browser or do you which to load it somewhere in your dialog, or what?
Regards Thomas Linder Puls
PDC

Frank
Posts: 22
Joined: 23 Nov 2014 20:41

Accessing a specific URL from within the code

Unread post by Frank » 21 Feb 2017 17:29

Thanks Thomas.

All I want to open the website in an external browser, once the button is clicked.

Or alternatively if it makes it easier, I would like to put a URL link in my dialog box such that once someone clicks on that to open that website in an external browser.

Best,
Frank

Frank
Posts: 22
Joined: 23 Nov 2014 20:41

Accessing a specific URL from within the code

Unread post by Frank » 24 Feb 2017 18:46

I was able to find the webBrowser code in the example section that deals with the URLs.
Apparently opening a URL in an external browser is achieved through the webBrowserControl type control( which is not an standard Control) on the Form. But I cannot figure out how to include such a control on a Form.

User avatar
Thomas Linder Puls
VIP Member
Posts: 1168
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 26 Feb 2017 13:55

If you want to open an URL in an independent browser, which your program should not otherwise control or interact with, then you should use call shell_api::shellOpen with the URL.

But if you want to open it in a separate browser that your program control, then you should use the internetExplorer class.

And finally if you want to have a web browser embedded directly in your own dialog then you should use the webBrowser control.
Regards Thomas Linder Puls
PDC

Frank
Posts: 22
Joined: 23 Nov 2014 20:41

Accessing a specific URL from within the code

Unread post by Frank » 26 Feb 2017 18:12

Thank you Thomas.
For now I used webBrowser control and it works fine for what I wanted to do.

Best,
Frank

Post Reply