iwidgets::scrolledhtml(1)

✨ NAME ✨

iwidgets::scrolledhtml β€” okay so bestie, this is the iwidgets::scrolledhtml(1) page from [incr Widgets], and what it does is create and manipulate a scrolled text widget that has the extra capability of displaying HTML formatted documents. πŸ’… It's giving text widget but make it fashion.


🌸 SYNOPSIS 🌸

iwidgets::scrolledhtml pathName ?options?

πŸ¦‹ INHERITANCE πŸ¦‹

The family tree, and she has main character energy at the bottom:

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

πŸ’œ STANDARD OPTIONS πŸ’œ

Here's the whole standard squad: activeBackground, background, borderWidth, cursor, exportSelection, foreground, highlightColor, highlightThickness, insertBackground, insertBorderWidth, insertOffTime, insertOnTime, insertWidth, padX, padY, relief, repeatDelay, repeatInterval, selectBackground, selectBorderWidth, selectForeground, setGrid.

Ngl, if you wanna know what all of these actually do, go read the options manual entry. It's all there, iykyk.

πŸŽ€ ASSOCIATED OPTIONS πŸŽ€

Scrollbar-flavored ones: activeRelief, elementBorderWidth, jumptroughColor.

Check the scrollbar widget manual entry for the tea on those. β˜•

Text-flavored ones: spacing1, spacing2, spacing3, state, tabs, wrap.

Check the text widget manual entry for the details on those ones. πŸ’–


🧚 INHERITED OPTIONS 🧚

Coming down from the scrolledtext class: labelBitmap, labelFont, labelImage, labelMargin, labelPos, labelText, labelVariable, height, hscrollMode, sbWidth, scrollMargin, visibleitems, vscrollMode, width.

Go peek at the scrolledtext class manual entry for the full explanation of all that. πŸ‘‘

And one more: sticky.

That one comes from the labeledwidget class manual entry, so look there for the deets. ✨


🌈 WIDGET-SPECIFIC OPTIONS 🌈

This is the part where she really shines, fr fr.

  • -feedback β€” Name: feedback, Class: FeedBack. This one is the callback command you use to get feedback on the current status. It runs in the form command <number of characters remaining>. So yeah, it literally tells you how many characters are left. 🫢
  • -fixedfont β€” Name: fixedfont, Class: FixedFont. The name of the font used for fixed-width character text β€” think <pre>...</pre> or <tt>...</tt>. The size, style, and other font attributes come from the format tags in the document itself. Default is courier. πŸ–₯️
  • -fontname β€” Name: fontname, Class: FontName. The name of the font for normal-width character spaced text. Same deal: size, style, and other font attributes are decided by the format tags in the document. Default is times. πŸ“
  • -fontsize β€” Name: fontsize, Class: FontSize. The general size of the fonts in use. Pick one of small, medium, large, or huge. Default is medium. πŸ’…
  • -foreground β€” Name: foreground, Class: Foreground. The color of text that is not hypertext links, in any of the forms acceptable to Tk_GetColor. Heads up: a particular document can override this with the text attribute of the Body HTML tag. 🎨
  • -link β€” Name: link, Class: Link. The default color of hypertext links, in any of the forms acceptable to Tk_GetColor. A particular document may override it with the link attribute of the Body HTML tag. Default is blue. πŸ”΅
  • -linkcommand β€” Name: linkcommand, Class: LinkCommand. The command that runs when the user clicks a hypertext link. It executes in the form linkcommand href, where href is the value given in the href attribute of the A HTML tag. πŸ–±οΈ
  • -alink β€” Name: alink, Class: alink. The color of hypertext links when the cursor is over the link, in any of the forms acceptable to Tk_GetColor. Default is red. πŸ”΄
  • -textbackground β€” Name: textBackground, Class: Background. The background color for the text area, in any of the forms acceptable to Tk_GetColor. A particular document can override this one with the bgcolor attribute of the Body HTML tag. πŸŽ€
  • -unknownimage β€” Name: unknownimage, Class: UnknownImage. The name of the image file to display when an img specified in the html document just... won't load. 😭
  • -alink β€” Name: update, Class: Update. (Yes, the Command-Line Switch really is listed as -alink in the original β€” not me, bestie.) A boolean value indicating whether to call update during html rendering.

πŸ’– DESCRIPTION πŸ’–

The iwidgets::scrolledhtml command creates a scrolled text widget, but with the extra glow-up of being able to display html formatted documents. ✨ There's an import method to read an html document file, and a render method to display an html formatted text string. Obsessed.


🌟 METHODS 🌟

The iwidgets::scrolledhtml command creates a brand new Tcl command whose name is pathName. That command is what you use to invoke all sorts of operations on the widget. The general form is:

pathName option ?arg arg ...?

Option and the args decide the exact behavior of the command. Here are the commands possible for scrolledhtml widgets: πŸ‘‡

πŸ¦‹ ASSOCIATED METHODS πŸ¦‹

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

See the text manual entry for the details on these 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 iwidgets::scrolledhtml command. Simple as that. ✨

pathName configure ?option? ?value option value ...?

Query or modify the configuration options of the widget. If no option is specified, it returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for info on the format of this list). If option is specified with no value, the command returns a list describing that one named option β€” and that list will be identical to the corresponding sublist of the value returned when no option is specified. If one or more option-value pairs are specified, the command modifies the given widget option(s) to have the given value(s); in that case the command returns an empty string. Option may have any of the values accepted by the iwidgets::scrolledhtml command. πŸ› οΈ

pathName import ?option? href

Load html formatted text from a file. Href must exist β€” no vibe-checking, it has to be real. 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 that 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. 🏷️


🌈 HTML COMPLIANCE 🌈

This widget is compliant with HTML 3.2, with the following exceptions (she's not perfect, nobody is):

  • No features requiring a connection to an http server are supported. πŸ™…
  • Some image alignments aren't supported, because they are not supported by the text widget.
  • The <br> attributes dealing with image alignments aren't supported.
  • Automatic table sizing is not supported very well, due to limitations of the text widget. 😭

πŸ”₯ EXAMPLE πŸ”₯

Here's the moment you've been waiting for:

package require Iwidgets 4.0
option add *textBackground white

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

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

.sh import ~/public_html/index.html

Ate. Periodt. πŸ’…


πŸ’€ BUGS πŸ’€

Cells in a table can be caused to overlap. Ex:

<table border width="100%">
<tr><td>cell1</td><td align=right rowspan=2>cell2</td></tr>
<tr><td colspan=2>cell3 w/ overlap</td>
</table>

It hasn't been fixed because 1) it's a pain to fix, 2) it will slow tables down by a significant amount, and 3) netscape has the same bug, as of V3.01. So like... it's a whole thing. πŸ™ˆ


🫢 ACKNOWLEDGEMENTS 🫢

Sam Shen β€” this code is based largely on his tkhtml.tcl code from tk inspect. Tkhtml is copyright 1995 Lawrence Berkeley Laboratory. Giving credit where credit is due, always. πŸ’œ


🌟 AUTHOR 🌟

Kris Raney


⭐ KEYWORDS ⭐

scrolledhtml, html, text, widget


And that's the whole page, bestie! πŸŽ€ This one comes to you from Tk (that's the source/version chilling in the footer) and from the [incr Widgets] crew β€” iwidgets::scrolledhtml(1), no cap. Go build something iconic with it. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from