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.