This is a draft interface specification for the Tk HTML widget currently under development. Since it is still a draft, it is subject to change. Eventually, the interface will stabilize and this interface specification will morph into a manual page.
-appletcommand |
This option specifies the name of the Tcl procedure to invoke when the <applet>...</applet> tag sequence is seen. The html widget will append two arguments to the procedure before calling it. The first argument is the name of a widget that the callback should create to hold the applet. The second argument is a list of name/value pairs which are the arguments to the <applet> tag. The text between <applet> and </applet> is normally suppressed. However, if the -appletcommand option is set to the empty string, the <applet> tag is ignored and all text between <applet> and </applet> is displayed normally. "<embed>" is treated as an alias for "<applet></applet>". |
-background |
The background color for the widget. Note that the <body bgcolor=...> HTML tag does not automatically cause the widget to change its background color. If you want the background color to change in response to this HTML tag, then your Tcl script should intercept the <body> tag using the ``token handler'' widget command (described below) and change the background color manually. |
-base |
The base URI for the current document. This should be set to the URI that was used to retrieve the document before parsing begins. |
-bd | An alias for -borderwidth |
-bg | An alias for -background |
-borderwidth |
The width of the 3-D border drawn around the parameter of the widget, in pixels. |
-cursor |
The cursor displayed when the pointer is positioned over the HTML widget. If {}, the cursor reverts to its default shape. |
-exportselection | |
-fontcommand |
The name of a TCL procedure that is used to convert HTML font names into TCL font names. A default built-in procedure is used if the value of this option is {}. When the HTML widget needs a new font, it calls this procedure with two arguments. This first argument is the font size expressed as an integer between 1 and 7. The standard size is 4. The second argument is a set of between 0 and 3 keywords drawn from the following set: "bold", "italic", and "fixed". If the "bold" keyword is present in the second argument, the font returned should be bold. If the "italic" keyword is present, the font should be italic. If the "fixed" keyword is present, the font should be fixed-width. The TCL procedure should return the name of the TCL font that the HTML widget will use to render the given HTML font. If the TCL procedure returns an empty string, then the built-in default procedure is used to determine the font. Examples: This is {4 {}}. This is {4 fixed}.
This is {3 {}}. |
-fg | An alias for -foreground. |
-foreground | The default foreground color in which HTML text is rendered. The HTML can override this using the color=... attribute on various HTML tags. |
-formcommand string
|
Declares a handler for everything to do with forms within a document.
Arguments will be appended to string and the result evaluated
during parsing (for form creation) and when the widget is cleared (for
form cleanup). The first argument is a token for
identifying a form. The second argument selects the action to perform.
The remaining arguments depend on the action, as follows.
name attribute
fairly directly to link
together related widgets, but it will likely cause incorrect
behaviours. Also be careful to observe the order in which the elements are
created; this determines the order in which they must be submitted.
A default form handler with the correct bahaviour written in TCL will be
bundled with the widget.
The attribute names will be downcased within attrs. |
-framecommand | The script specified by this option is invoked when the HTML parser encounters a <frameset>...</frameset> tag sequence. The arguments to the script are TBD. If the value of the option is the empty string, then the text within the <noframe>...</noframe> tag sequence is displayed. |
-height | Specifies the height of the area into which HTML is rendered. This value plus twice the -padx, -borderwidth and -highlightthickness values is the total height of the widget. |
-highlightbackground | |
-highlightcolor | |
-highlightthickness | |
-hyperlinkcommand | The script specified by this option is invoked whenever the user clicks on a hyperlink on the HTML page. Before invoking this script, the URI for the hyperlink is appended. |
-imagecommand |
When a ``<img src=...>'' tag is encountered, the
HTML widget invokes the script specified by this option in order to
get the name of a Tk image object to display the HTML image.
Before invoking the script, the following arguments are appended:
|
-isvisitedcommand | When the HTML widget encounters a hyperlink (``<a href=...>'') it invokes the script specified by this option in order to determine whether or not the hyperlink has been visited. This information is needed to determine what color to use to display the hyperlink. |
-padx | The amount of extra space to insert between the 3-D border and the left and right sides of the document text. |
-pady | The amount of extra space to insert between the 3-D border and the top and bottom of the document text. |
-relief | The relief used to draw the 3-D border. |
-resolvercommand |
The name of a TCL command used to resolve URIs. If blank, a built-in resolver is used. If a TCL command is specified but it returns an empty string, the built-in resolver is used then too. The build-in resolver is based on the algorithm in section 5.2 of RFC 2396. Multiple URIs are appended to the TCL command before it is executed. The first URI is the BASE URI of the document (the URL that specified by the -base configuration option and updated according to any prior <BASE> markup). Zero or more additional URIs are appended to this base. The result of the script should be the resolution of the whole series or URIs. |
-rulerelief |
Determines the appearance of the Horizontal Rule (<HR>) markup. The default is "sunken". This can also be "raised" or "flat". If "flat", then the <HR> is drawn using a solid line in the current foreground color. "groove" and "ridge" are the same as "flat". |
-scriptcommand |
Whenever <SCRIPT>...</SCRIPT> markup is encountered in the input HTML, the attributes of the <SCRIPT> markup and the body of the script are appended to this string and the result is executed as a TCL command. If this options is the empty string, then the script is ignored. |
-selectioncolor | The background color used when drawing the selection. The foreground color for the selection is the same as the regular foreground color. |
-tablerelief |
Determines the appearance of the borders around tables. The default is "raised". This can also be "sunken" or "flat". If "flat", then the borders is drawn using solid lines in the current foreground color. "groove" and "ridge" are the same as "flat". |
-takefocus | |
-unvisitedcolor | The foreground color used to draw hyperlinks that have not been visited. |
-underlinehyperlinks | Set to TRUE to cause hyperlinks to be drawn using an underlined font. |
-visitedcolor | The foreground color used to draw hyperlinks that have been visited. |
-width | The width of the document text. This value does not include space allocated for -highlightthickness, -borderwiddth or -padx. |
-xscrollcommand | |
-yscrollcommand |
Within a single Text or Space token, individual characters are also identified by number, though the counting starts with 0 instead of 1. The character number is connected to the token number by a period. So, for example, the 4th character in the 9th token would be ``9.3''.
Two integers separated by a dot is called the connonical form of an index. Other index forms are available, including:
end | The keyword ``end'' means one character past the last character of the last token. |
@X,Y | The character located at screen coordinates X,Y. |
*.last | The second integer can be replaced by the keyword ``last'' to mean the last character in the token. |
sel.first | This is the first character that is part of the selection. |
sel.last | This is the last character that is part of the selection. |
ins | The character immediately following the insertion cursor. |
From and to may be any of the following values:
plain | Ordinary text with no characters escaped. |
http | The text is encoded in a form suitable for use with the HTTP protocol. Spaces are converted to "+". Special characters and escaped as "%aa" where "a" is a hexadecimal digit. A special character is anything other than an alphanumeric or one of these: ".", "$", "-", or "_". |
url | The text is encoded in a form suitable for use as a URI. Spaces are converted to "+". Special characters and escaped as "%aa" where "a" is a hexadecimal digit. A special character is anything other than an alphanumeric or one of these: ".", "$", "-", "_", or "/". |
html | The text is encoded in a form suitable for use within HTML. "&" is encoded as "&", "<" is encoded as "<" and so forth. |
This command is intended to be useful to the TCL procedures that implement callbacks for the HTML widget.
The optional 3rd and 4th arguments specify a displacement from INDEX to the value of the index returned. COUNT can be any integer value, including a negative number. UNITS must be either ``char'' or ``line''.
The vertical position of the document can be moved to any of these names using the ``WIDGET yview NAME'' command described below.
Returns plain ASCII text that represents all characters between INDEX-1 and INDEX-2. Formatting tags are omitted. The INDEX-1 character is included by INDEX-2 is omitted.
All text from INDEX-1 up to, but not including INDEX-2 is removed and the display is updated accordingly.
Returns HTML text that represents all characters and formatting tags between INDEX-1 and INDEX-2. The INDEX-1 character is included by INDEX-2 is omitted.
Inserts one or more characters immediately before the character whose index is given.
Some of the following subcommands make use of indices. The character number of these indices is ignored since these commands deal only with whole tokens.
Only one handler may be defined for each token type. If a new handler is specified for a token type that previously had a different handler defined, then the old handler is overwritten by the new.