/* default height & width */
#define _HTMLHELP_H 340
#define _HTMLHELP_W 320
/* displays help doc */
htmlhelp(html, title, tool, height, width, checkdoctitle)
{
local shown = 0, vname, h, path, fname;
local hatx, doc, check;
if (argc < 6)
{
if (argc < 5)
{
if (argc < 4)
{
if (argc < 3)
{
if (argc < 2)
{
if (argc < 1) error("htmlhelp - help file name required");
title = version(13);
}
tool = 0;
}
height = _HTMLHELP_H;
}
width = _HTMLHELP_W;
}
chkdoctitle = 1;
}
(path, fname) = dirpath(html);
fname = strget(1, fname, ".");
vname = sprintf("_%s_handle", fname);
defvar(sprintf("%s", vname), 0);
h = getvar(eval("vname"));
/* check if help already displayed */
if (ismenu(h))
{
if (h.title == title)
{
/* check html title */
hatx = h.control(100);
if (isobject(hatx))
{
doc = hatx.document;
if (isobject(doc))
{
/* check field */
check = (checkdoctitle) ? tolower(doc.title) == tolower(fname)
: 1;
if (check)
{
menushow(h, 1);
shown = 1;
}
}
}
}
}
if (not(shown))
{
/* display it */
h = viewhtml(which(html), title, tool, height, width);
setvar(eval("vname"), h);
}
}