viewHtml

This function takes the name of a file and displays it in an HTML widget. If one clicks on a link within this file (i.e. an internal anchor), the widget scrolls to the anchor's position in the file. This is a simple example of how one can use the gtkhtml widget from within R.

We read the contents of the file using readLines() and then pass them to the constructor of the HTML widget. One can interrogate the available signals for the HTML widget using

getSignalInfo("GtkHTML") 
Two of interest include link-clicked and submit. These are called when the user clicks on a hyper-link, and when a form is submitted, respectively.

In our simple example, we handle hyperlinks with a function that looks to see if the first character is # identifying an internal link, and if so, we use the gtkHTMLJumpToAnchor function to scroll to it.

Forms are handled by via the submit callback and this is given three strings. The first is the method for the form handler: GET or POST. The second string gives the value of the action attribute for the form element. And finally, we get the values for the form elements in a www-form-urlencoded format. This gives a collection of name=value values separated by a `&'. The function parseFormURL() function can be used to process this and return a vector of values indexed by the name of the element.

localOutput

This function creates a window containing two HTML widgets. The top one displays an HTML document given by the filename passed as the first argument. This is expected to contain a form containing an input area into which the user types S commands. These are evaluated and the results displayed in the second HTML widget. This gives the basic interface

parseFormURL

htmlOutputFilter


Duncan Temple Lang <duncan@research.bell-labs.com>
Last modified: Sun Dec 9 14:13:58 EST 2001