Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

htmlhelp quick question

40 views
Skip to first unread message

thirdsh...@gmail.com

unread,
Jun 27, 2015, 4:31:51 PM6/27/15
to
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.

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

thirdsh...@gmail.com

unread,
Jun 27, 2015, 5:34:41 PM6/27/15
to
I meant to say I think it has to do with namespaces. I don't understand this line of code. Why is there a space between the namespace path and HTMLHelp?
I get invalid command when I try to call HMparse_html.

snit::widgetadaptor HTMLHelp {

I am trying to find the qualified name to call the proc on this line:

proc HMparse_html {html {cmd HMtest_parse} {start hmstart}} {

thanks


thirdsh...@gmail.com

unread,
Jun 27, 2015, 5:50:07 PM6/27/15
to
Hi-

I may have had a breakthrough. I get this error:


Error in startup script: wrong # args: should be "::HTMLHelp::HMinit_win selfns win"

so the computer knows how I need to call it when I guessed the ::HTMLHelp:: part.
Now I will have to figure out what selfns and win represent.

I think I can use cliff flynt's book for a tip.

thanks

Robert Heller

unread,
Jun 27, 2015, 6:41:34 PM6/27/15
to
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

thirdsh...@gmail.com

unread,
Jun 27, 2015, 6:45:13 PM6/27/15
to
I need to know how to call HMrender. The missing argument error msg is this:

Error in startup script: wrong # args: should be "HMrender selfns win tag not param text". I don't know what selfns is supposed to represent. Is it the namespace for the calling tcl script?


lappend auto_path "/home/username/Heller"

package require HTMLHelp 2.0

toplevel .t

set mytext [text .t.txt -height 10 -width 50]

grid $mytext


::HTMLHelp::HMinit_win :: $mytext
set html { <html> <body> <p> <b> foo </b> </p> </body> </html> }


# HTMLHelp::HMparse_html [args go here]

I am off to go learn about teapot. I don't even know where I'd go to download the teapot software so I can find the binary. I will go read about it.

thanks Robert for trying to help.
I don't know where there is a tutorial so I know what arguments to supply.

I am going to try to get the binary that Gerald suggested just in case Robert can't get back to me.

thanks again.



thirdsh...@gmail.com

unread,
Jun 27, 2015, 6:52:27 PM6/27/15
to

> >
>
> --
> Robert Heller -- 978-544-6933
> Deepwoods Software -- Custom Software Services
> http://www.deepsoft.com/ -- Linux Administration Services
> hel...@deepsoft.com -- Webhosting Services

Oh...I missed your post. I will read it after taking a short break. Thanks for explaining how it works.

THANKS!

Robert Heller

unread,
Jun 27, 2015, 7:30:38 PM6/27/15
to
At Sat, 27 Jun 2015 14:34:37 -0700 (PDT) thirdsh...@gmail.com wrote:

>
> On Saturday, June 27, 2015 at 4:31:51 PM UTC-4, 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.
> >
> > 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
>
> I meant to say I think it has to do with namespaces. I don't understand this
> line of code. Why is there a space between the namespace path and HTMLHelp?

It is not a namespace, it is a SNIT OO class definiation.

Please read 'man n snit' and 'man n snitfaq' for more complete enlightenment:

WHAT IS SNIT?
Snit is a framework for defining abstract data types and
megawidgets in pure Tcl. The name "Snit" stands for "Snit's Not
Incr Tcl", signifying that Snit takes a different approach to
defining objects than does Incr Tcl, the best known object
framework for Tcl. Had I realized that Snit would become at all
popular, I'd probably have chosen something else.


> I get invalid command when I try to call HMparse_html.
>
> snit::widgetadaptor HTMLHelp {
>
> I am trying to find the qualified name to call the proc on this line:
>
> proc HMparse_html {html {cmd HMtest_parse} {start hmstart}} {
>
> thanks
>
>
>

thirdsh...@gmail.com

unread,
Jun 27, 2015, 7:57:46 PM6/27/15
to

>
> It is not a namespace, it is a SNIT OO class definiation.
>
> Please read 'man n snit' and 'man n snitfaq' for more complete enlightenment:
>
> WHAT IS SNIT?
> Snit is a framework for defining abstract data types and
> megawidgets in pure Tcl. The name "Snit" stands for "Snit's Not
> Incr Tcl", signifying that Snit takes a different approach to
> defining objects than does Incr Tcl, the best known object
> framework for Tcl. Had I realized that Snit would become at all
> popular, I'd probably have chosen something else.
>
>
> > I get invalid command when I try to call HMparse_html.
> >
> > snit::widgetadaptor HTMLHelp {
> >
> > I am trying to find the qualified name to call the proc on this line:
> >
> > proc HMparse_html {html {cmd HMtest_parse} {start hmstart}} {
> >
> > thanks
> >
> >
> >
>
> --
> Robert Heller -- 978-544-6933
> Deepwoods Software -- Custom Software Services
> http://www.deepsoft.com/ -- Linux Administration Services
> hel...@deepsoft.com -- Webhosting Services

ohh.. Now I get it. I know a little bit about objects. I don't know why I didn't pick up on that. I read a little about that soccer club object system (xotcl) before etc. Your explanation regarding the help system is really cool. I had a little time to read it before I made a caffeine run.

I am going to start trying to code more in line with the TCL way. Right now I am struggling with other things in my project like getting things to work, finding things, and installing them, but I'd like at some point to return to the actual writing code and fix my code so it is more proper with namespaces done the right way. For instance, I wasn't using the variable command in my namespace.

It is cool you know that object system.

Have a great rest of the weekend. THANKS!
jim

0 new messages