Silverfrost Logo About Us | Contact Us
 

%wb - Web Browser

Purpose

To provide an interface to Internet Explorer.

Syntax

winio@('%N.Mwb[resource_or_url]')

Description

Provides direct access to the Microsoft Internet Explorer engine. This means that, unlike %ht - Hypertext, %wb can use any form of script provided only that it could be viewed in Internet Explorer. As with %ht, the basic form for %wb is:

winio@('%N.Mwb[resource_or_url]')

N and M provide the dimensions in the same way as for %ht.

Within the square brackets you can provide a URL, for example [http://forums.silverfrost.com/index.php] or [file://C:\MyDir\Myfile.html] or [file://C:\MyDir\Myfile.html#MySection].

For access to a document (MyDoc.htm) within a .chm file (MyChm.chm), the URL would take the form:

[its:C:\\MyDir\\MyChm.chm::MyDoc.htm]

Alternatively you can provide the name of an HTML resource within the square brackets, for example [myhtml] together with a resource script containing a line of the form:

myhtml HYPERTEXT "C:\MyDir\Myfile.html"

For third-party compilers use HTML in place of HYPERTEXT.

There are a list of standard callbacks associated with %wb

"wbCopy"Copy the selected text to the clipboard
"wbSelectAll"Select all the text
"wbSaveAs"Open a "Save As" dialog
"wbOpen"Open a dialog to navigate to a chosen URL
"wbGoForward"Revisit a page after going back
"wbGoBack"Revisit the previous page
"wbGoHome"Go to the IE "Home" URL on the current machine
"wbRefresh"Refresh the current page
"wbStop"Stop an ongoing action (e.g. downloading)
"wbHistory"View a dialog showing the page history in the current session in order to revisit a chosen page

The function wbCommand@ that can be used to navigate to a given URL or to directly call one of the above %wb standard callbacks.

%wb can take a callback function that is called before every URL navigation. The CLEARWIN_STRING@ "CALLBACK_REASON" is "HYPERTEXT_LINK" at which point the CLEARWIN_STRING@ "CURRENT_URL" provides the URL. The callback should return the value 2 in order to complete the navigation. Alternatively the value 3 will cancel the navigation and can be used to perform some other task in response to the hyperlink.

Unlike %ht, a given window can contain more than one %wb control.

%wb is much more versatile than %ht. When compared with %ht, its only limitation is that images can not be embedded within a resource script and must be provided either as external files or as direct data. See for example http://www.websiteoptimization.com/speed/tweak/inline-images/ which provides a markup of the form...

<img src="data:image/gif;base64, ...raw data inserted here..." width="16" height="14" alt="embedded folder icon">

Depending on the operating system, the internal dialog for "wbHistory" may look better when you include a standard manifest file in your resource script...

1 24 default.manifest

Example

program WebPage
 use clrwin$
 integer iw
 integer,external::cbForum,cbWeb
 iw=winio$("%ww[no_border]%ca[New HTML]&")
 iw=winio$("%pm[Back,Forward,History,Copy,Forum]&", &
      & "wbGoBack", "wbGoForward", "wbHistory", "wbCopy", cbForum)
 iw=winio$("%pv%60.30^wb[http://www.silverfrost.com]", cbWeb)
end

integer function cbForum()
 use clrwin$
 integer r
 r = wbCommand$("http://forums.silverfrost.com")
 cbForum = 2
end function

integer function cbWeb()
 use clrwin$
 character(len=256)::reason,url
 reason = clearwin_string$("CALLBACK_REASON")
 url = clearwin_string$("CURRENT_URL")
 print*, reason(1:len_trim(reason)), " = ", url(1:len_trim(url))
 cbWeb = 2
end function

See also

%ht - Hypertext


 

 

 

Copyright © 1999-2017 Silverfrost Limited