At Sat, 27 Jun 2015 13:31:45 -0700 (PDT)
thirdsh...@gmail.com wrote:
>
> Hi Robert-
>
> I used ftp to obtain files. I put them in a directory named Heller.
> I used pkg_mkIndex . *.tcl once for each subdirectory under Heller.
> Then I used this little Tcl script to run the code, but I get an invalid
> command name. I think it has to do with packages. Can you assist? Here is
> the tcl file I set up to use the package.
It is not *packages*, it is a SNIT OO class thing. You can't use the 'procs'
that are defined inside snit::widgetadaptor HTMLHelp { ... } outside of the
widgetadaptor. They only work inside the *methods* (and typemethods) defined
there. This code defines a new 'widget', which is actually a toplevel dialog
type of widget.
You use it like this:
lappend auto_path "/home/username/Heller"
package require HTMLHelp 2.0
set HTMLdir /some/path/to/a/directory/of/HTML/files
HTMLHelp setDefaults $HTMLdir toc.html
HTMLHelp help "This is a help topic"
### OR
HTMLHelp .myhelpdialog \
-helpdirectory /some/path/to/a/directory/of/HTML/files \
-tableofcontents toc.html
myhelpdialog helpTopic "This is a help topic"
The directory of HTML files ($HTMLdir), which can also have .css and image
files, is your collection of help files, either hand crafted or created with a
tool like doxygen or tex4ht or (shudder) MS-Word or LibreOffice. The toc.html
file is one of these files that contains a 'table of contents', which is
presumed to be a link menu, typically a <ul> or <ol> block containing items
like '<li><a href="...">This is a help topic</a></li>', but really can be
anything. What happens is a 'help' dialog is popped up. This (transisent)
toplevel contains two text widgets, each with scrollbars, with a search entry
and some buttons underneith. The text area on the left is narrow and contains
toc.html and the one on the right contains the HTML file that the argument
'points' to. The widget 'looks' for the text and get the link that text is an
anchor for.
The link, image, and css URLs in the help text have to be relative and not
include any network logic (no protocol, no hostname): Eg:
<a href="index.html">This is the index</a>
NOT
<a href="
http://somehost.example.com/index.html">This is the index</a>
or
<a href="file:///home/someone/index.html">This is the index</a>
You *can* use anchors (#):
<a href="dialogs.html#color-picker-dialog">Color Picker Dialog</a>
This will load and 'render' $HTMLDir/dialogs.html and then make the place
where the anchor for color-picker-dialog (<a id="color-picker-dialog"></a>)
visible, using the text widget's 'see' command.
One can have multiple help dialogs (created one by one using the constructor)
with different collections of help text, or one can just have a 'global'
shared help dialog (created inside the 'help' typemethod the first time it is
called and then re-used on latter calls). For a typical program's 'online'
help -- eg what you get off the Help menu or Help buttons on dialog boxes, it
really only makes sense to have a unified collection of help files and just
use the a single shared help dialog -- this package is not really meant to be
used as a normal web browser, with any number of browser windows (or tabs). I
just bind all Help menu commands to something like 'HTMLHelp help "help
topic"': for example:
menu .m.h add command -label "On Help" -command "HTMLHelp help Help"
presuming somewhere in toc.html is '<a href="help.html">Help</a>'
or
menu .m.h add command -label "Tutorial" -command "HTMLHelp help Tutorial"
presuming somewhere in toc.html is '<a href="Tutorial.html">Tutorial</a>'
>
> lappend auto_path "/home/username/Heller"
>
> package require HTMLHelp 2.0
>
> toplevel .t
>
> set mytext [text .t.htext]
> pack $mytext
>
>
> HMinit_win $mytext
> set html { <html> <body> <p> <b> foo </b> </p> </body> </html> }
>
> HMparse_html $html "HMrender $mytext"
>
> # end .tcl file
>
> THANKS for any assistance !
>
> jim
>
--
Robert Heller --
978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services