# scrolledhtml - Create and manipulate a scrolled text widget with the capability

of displaying HTML formatted documents.

## SYNOPSIS

scrolledhtml pathName ?options?

## INHERITANCE

itk::Widget <- Labeledwidget <- Scrolledtext <- Scrolledhtml

## STANDARD OPTIONS

activeBackground exportSelection insertBackground insertWidth repeatDelay selectForeground | background foreground insertBorderWidth padX repeatInterval setGrid | borderWidth highlightColor insertOffTime padY selectBackground | cursor highlightThickness insertOnTime relief selectBorderWidth

See the "options" manual entry for details on the standard options.

## ASSOCIATED OPTIONS

activeRelief | elementBorderWidth | jump | troughColor

See the "scrollbar" widget manual entry for details on the above associated options.

spacing1 wrap | spacing2 | spacing3 | state

See the "text" widget manual entry for details on the above associated options.

## INHERITED OPTIONS

labelBitmap labelPos hscrollMode vscrollMode | labelFont labelText sbWidth width | labelImage labelVariable scrollMargin | labelMargin height visibleitems

See the "scrolledtext" class manual entry for details on the inherited options.

## WIDGET-SPECIFIC OPTIONS

    Name:                   feedback
    Class:                  FeedBack
    Command-Line Switch:	-feedback

Specifies the callback command to use to give feedback on current status. Two integers are appended onto this command. They represent the current point in the rendering process, and the maximum point. The maximum depends on the length of the text being rendered.

    Name:                   fixedfont
    Class:                  FixedFont
    Command-Line Switch:	-fixedfont

Specifies the name of the font to be used for fixed-width character text (such as <pre>...</pre> or <tt>...</tt>.) The size, style, and other font attributes are determined by the format tags in the document. The default is courier.

    Name:                   fontname
    Class:                  FontName
    Command-Line Switch:	-fontname

Specifies the name of the font to be used for normal-width character spaced text. The size, style, and other font attributes are determined by the format tags in the document. The default is times.

    Name:                   fontsize
    Class:                  FontSize
    Command-Line Switch:	-fontsize

Specifies the general size of the fonts used. One of small, medium, large, or huge. The default is medium.

    Name:                   foreground
    Class:                  Foreground
    Command-Line Switch:	-foreground

Specifies the color of text other than hypertext links, in any of the forms acceptable to Tk_GetColor. This value may be overridden in a particular document by the text attribute of the Body HTML tag.

    Name:                   link
    Class:                  Link
    Command-Line Switch:	-link

Specifies the default color of hypertext links in any of the forms acceptable to Tk_GetColor. This value may be overridden in a particular document by the link attribute of the Body HTML tag. The default is blue.

    Name:                   linkcommand
    Class:                  LinkCommand
    Command-Line Switch:	-linkcommand

Specifies the command to execute when the user clicks on a hypertext link. Execution is of the form linkcommand href, where href is the value given in the href attribute of the A HTML tag.

    Name:                   linkhighlight
    Class:                  LinkHighlight
    Command-Line Switch:	-linkhighlight

Specifies the color of hypertext links when the cursor is over the link in any of the forms acceptable to Tk_GetColor. The default is red.

    Name:                   textBackground
    Class:                  Background
    Command-Line Switch:	-textbackground

Specifies the background color for the text area in any of the forms acceptable to Tk_GetColor. This value may be overridden in a particular document by the bgcolor attribute of the Body HTML tag.

    Name:                   unknownimage
    Class:                  UnknownImage
    Command-Line Switch:	-unknownimage

Specifies the name of the image file to display when an img specified in the html document cannot be loaded.

## DESCRIPTION

The scrolledhtml command creates a scrolled text widget with the additional capability to display html formatted documents. An import method is provided to read an html document file, and a render method is provided to display a html formatted text string.

## METHODS

The scrolledhtml command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form:

    pathName option ?arg arg ...?

Option and the args determine the exact behavior of the command. The following commands are possible for scrolledhtml widgets:

## ASSOCIATED METHODS

bbox dlineinfo mark tag | compare get scan window | debug index search xview | delete insert see yview

See the "text" manual entry for details on the standard methods.

## INHERITED METHODS

export | clear |  |

See the "scrolledhtml" manual entry for details on the inherited methods.

## WIDGET-SPECIFIC METHODS

pathName cget option

  Returns the current value of the configuration option given by option. Option may have any of the values accepted by the scrolledhtml command.
  pathName configure ?option? ?value option value ...?
    Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the scrolledhtml command.
  pathName import ?option? href
    Load html formatted text from a file. Href must exist. If option is -link, href is assumed to be relative to the application's current working directory. Otherwise, href is assumed to be relative to the path of the last page loaded. Href is either a filename, or a reference of the form filename#anchorname. In the latter form, fIFilename and/or anchorname may be empty. If filename is empty, the current document is assumed. If anchorname is empty, the top of the document is assumed.
  pathName pwd
    Print the current working directory of the widget, i.e. the directory of the last page loaded.
  pathName render htmltext ?wd?
    Display HTML formatted text htmltext. Wd gives the base path to use for all links and images in the document. Wd defaults to the application's current working directory.
  pathName title
    Return the title of the current page, as given in the <title>...</title> field in the document.

  ## SUPPORTED HTML TAGS

  a /a address /address b /b base big /big blockquote /blockquote body /body br center /center cite /cite code | /code dir /dir dl /dl dt dd dfn /dfn em /em h1 /h1 h2 /h2 h3 /h3 h4 /h4 | h5 /h5 h6 /h6 i /i img kbd li listing /listing menu /menu ol /ol p pre /pre samp | /samp small /small sub /sub sup /sup strong /strong title /title tt /tt u /u ul /ul var /var

  ## TAGS WITH ATTRIBUTES

  a
  href
    reference to html document, of the form filename#anchorname
  name
    name of this anchor, to be used in an href
  id
    same as name
  body
  bgcolor
    background color
  link
    color of hypertext links
  text
    color of text
  hn
  align
    text alignment, one of left, right, or center
  src
    path to image to precede text
  hr
  noshade
    if present, indicates the rule should be a plain black line
  size
    height of the rule, in pixels
  img
  alt
    text to display in place of image if image is not found
  height
    height of area to reserve if image is not found
  src
    filename of image
  width
    width of area to reserve if image is not found
  p
  align
    alignment of following paragraph, one of left, right, or center. Defaults to alignment of previous paragraph, or left for first paragraph
  id
    ID for use as anchorname in a link to this document
  ul
  plain
    if present list will not use bullets
  src
    image to use as bullet
  dingbat
    same as src

  ## EXAMPLE

       option add *textBackground white

       scrolledhtml .sh -fontname helvetica -linkcommand "this import -link"

       pack .sh -padx 10 -pady 10 -fill both -expand yes

       .sh import ~/public_html/index.html

  ## ACKNOWLEDGEMENTS

  Sam Shen
  This code is based largely on his tkhtml.tcl code from tk inspect. Tkhtml is copyright 1995 Lawrence Berkeley Laboratory.

  ## AUTHOR

  Kris Raney

  ## KEYWORDS

  scrolledhtml, html, text, widget