Re: [S] help functionality in dialog box

Prof Brian D Ripley (ripley@stats.ox.ac.uk)
Wed, 18 Nov 1998 07:57:21 +0000 (GMT)


> S-news members:
>
> S-Plus 4.0, Release 3 for Windows 95. Network version. (Update to S-Plus
> 4.5, Release 2 within the week, I understand.)
>
> A couple of questions:

Three, if we are counting. Questions about GUI programming are hard to
answer succinctly and I do suspect you need to talk to Technical Support
to talk through where the block is. 4.5r2 does help here.

> (1) I've written a menu addition for our local library from which users may
> use locally written functions with dialog boxes, rather than having to learn
> the command language. (They're very impressed that S-Plus has this
> capability, by the way, and don't, by and large, want to use it otherwise.)
> I have on that menu an item that links the user to the library's Windows
> help pages, but I'd like to be able to use the Help Button on the dialog box
> for the particular function being used to access directly that function's
> help page. I tried the HelpString argument to guiCreate for the relevant
> Group, but to no avail. Has someone a way I can do this?

Looks at how this is done in MASSdia: the source code is in the V&R library
set. For lda we have:

guiCreate("FunctionInfo", Name = "menuLDA",
Function = "menuLDA",
HelpCommand = "help(lda)",
...

> (2) I'd like to add a checkbox to the Logistic Regression dialog box, on
> the Results page, say, that will run and print out a local function to
> compute the Hosmer-Lemeshow goodness-of-fit test. I presently have that as
> a menu item in our local library, so users just save the output from the
> logistic regression fit (glm, of course) to a glm object then input that
> object into the dialog box and specify relelvant parameters. Much neater
> would be just make those options appear on S-Plus's Logistic Regression
> dialog box, with the appropriate options. Searching around the various
> S-Plus directories, both with and without the Object Browser looking for
> MenuItems, I'm unable to find where to modify the S-Plus's menu items or how
> to use guiModify() because I don't know how that dialog/function is named by
> S-Plus to identify it for modification. I imagine it's simply a matter of
> knowing the Name and particular Properties for that diaglog, but that's
> exactly what I can't find. I could not find what I need in the manuals,
> though I'd not be surprised to find I didn't look hard enough.

GUI properties are not in S-PLUS directories, they are in _Prefs. The
function are all in a library called something like menus or gui: use
find("menuLm") to find it.

As far as I can see it is very easy to find the menus in the Object
Browser: once you have opened down to the item you want and look at its
properties. That will tell you the S-PLUS function used. Then use
Object Browser to find the FunctionInfo property for that function, look at
its properties, and follow on until you find the results page. That will
tell you the S-PLUS function used for the page and you can start from
there.

I think it would be much better to copy this menu item to your local menu
and edit the copy.

> (3) Presently, using a .First file in which this local library is attached
> (at start-up) and then the .First.lib function within that library is
> executed and the menu item is finally added appears to over-write the S-Plus
> menu bar, so that only this local library's menu is available. This does
> not happen when the library is attached after start-up, as the S-Plus menu
> is intact and the local library's menu item is included and works. Is this
> particular to version 4.0 (r. 3)? Will that problem go away when we install
> version 4.5 (Professional)? [I saw a reference to this problem in Frank
> Harrell's .First.lib function for Hmisc regarding "version 4.x".]
> Naturally, having a user start-up with the local library attached and the
> menu item for the local library seamlessly inserted is the goal, without the
> user having to attach the library directly.

You need to use .guiFirst not .First (and I think that needs 4.5). Beware
that adding menus in this way and then removing them is time-consuming and
error-prone. As menus are saved in the _Prefs directly, I prefer to give
users a function to add the local menus which they execute once per
project. Your .guiFirst could check if that has been done (by letting the
addmenus function write an S-PLUS object).

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

----------------------------------------------------------------------- This message was distributed by s-news@wubios.wustl.edu. To unsubscribe send e-mail to s-news-request@wubios.wustl.edu with the BODY of the message: unsubscribe s-news