WISH User Help

WISH User Help megawidget

        http://www.pa-mcclamrock.com/papenguinspacks.html

http://www.pa-mcclamrock.com/wishuhelp.png

WISH User Help is the world's simplest hypertext help system (as far as I know, anyway). It's included with all the applications you can download for free from http://www.pa-mcclamrock.com/papenguinspacks.html . You'll find it (wishuhelp.tcl) in the /usr/local/lib/wishes subdirectory of the directory the tarball is unpacked into. WISH User Help requires Tcl and Tk 8.5 (or greater, when there is an even greater version).

To include WISH User Help in an application, do basically the following things, with whatever reasonable modifications you see fit (and let me know if you run into any problems).

1. Put these or similar code snippets in your Tcl/Tk executable:

 # Identify system directory ("$libdir") in which
 # WISH User Help (wishuhelp.tcl) will be found:
 set topdir /usr/local
 set libdir [file join $topdir lib wishes]

 # WISH User Help isn't yet loaded:
 set helpon 0

2. Create a button, menu item, or something to invoke a procedure that in turn will invoke WISH User Help--for example:

 button .help -text "HELP" -command comhelp

 # Procedure for setting up user help display:

 proc comhelp {} {
        global helpon libdir
        if {$helpon == 0} {
                source [file join $libdir wishuhelp.tcl]
                set helpon 1
        }
        uhelp ; # Set up user help window--from WISH User Help
        wm title .uhelp "WISH Command Center - User Help"
        set linkup [open $::helpfile r]
        set helpcontents [read $linkup]
        close $linkup
        .uhelp.tx insert 1.0 $helpcontents
        helplink .uhelp.tx; # Show links in text--from WISH User Help
        .uhelp.tx mark set insert 1.0
        .uhelp.tx configure -state disabled
 }

3. Create a help text file (to be identified with the global variable "helpfile"), using "Link-Text," the world's simplest hypertext markup language (I think). (WISH Supernotepad can slightly simplify the creation of the links, with the "Link" menu item under the "HTML" menu; it can also quickly switch between "markup" and "link" display of Link-Text files, by way of the "Link-Text" checkbox under the "Display" menu.) Here's all there is to it, with examples from the WISH Command Center help file:

 <bc>USER HELP GUIDE</bc>

 <bc>WISH Command Center 2008</bc>
 <c>by David McClamrock «<[email protected]>»</c>

 <b>WISH Command Center</b> is a simple program launcher written in Tcl/Tk....

The angular quotes - « » - are used to identify angle brackets that should be displayed literally and not interpreted as markup; «< thus corresponds to &lt; in HTML, and to &gt; . (Angular quotes are among the special characters you can get with the "Special Characters" menu item under the "Insert" menu in WISH Supernotepad.)

Only the following simple, HTML-like markup codes are used for bold, italic, and/or centered text:

 <b></b> : Bold
 <i></i> : Italic
 <c></c> or <center></center> : Centered

The three single-letter codes can be combined in any order to form beginning and ending tags, for example:

 <bi></ib> : Bold, Italic
 <bci></cib> : Bold, Italic, Centered

Markup code for links looks like this:

 <link "Run Programs:">Run Programs</link>

When the link is displayed and clicked, the "linkfind" procedure from WISH User Help will search for an exact match for the text between the quotes, in this case Run Programs: ; then the part of the file containing the matching text will be displayed in the WISH User Help window.

That's all there is to it; everything else is plain text, with no need for <p>, <br>, or any other markup.