Date: Thu, 9 Mar 95 10:52:16 EST From: wmooney@casws009.shl.com (William D. Mooney) To: oi-users@freefall.cdrom.com Cc: wmooney@casws009.shl.com Subject: Re: adding cells to Help menu Message-ID: <9503091552.AA00286@casws009.shl.com>
index | next in thread | raw e-mail
----- Begin Included Message -----
I've been trying to add some cells to the
Help menu in an app_window's main menu, but
I can't find the Help button menu in the
builder anywhere. In addition to 'On Context'
I'd like a couple of other Help menu options.
Dropping a cell onto the Help button menu doesn't
do the trick, and traversing the app_window and/or
@main_menu never reveal a Help menu.
----- End Included Message -----
David,
Here is a solution we cooked up. It replaces the Help menu button
with one of our own with a single help item. We could not find a way to do it
from the Builder. You could add additional items if you wish.
The .H and .C files follow. Somewhere in your main()
before you start OI_begin_interaction() have the statements:
#include "mungeHelp.H"
mungeHelp(topLevel[0]);
**** mungeHelp.H ****
#include <OI/oi.H>
///////////////////////
// mungeHelp -- function to set mungify the builtin OI Help menu button
// so that it invokes FrameMaker as help instead of the builtin OI
// context help.
//
// This function is very OI dependant, and requires an "@on_context"
// menu button object. If there doesn't exist such an object, this function
// will throw up a warning dialog box to inform the user that Frame Help
// is unavailable.
///////////////////////
void
mungeHelp(OI_d_tech *topWindow);
// Executable to invoke is Frame Viewer.
#define MH_EXECSTRING "viewer -f %s"
// FrameMaker helpfile path.
#define MH_HELPPATH "/usr/docs/aFrameHelpFile"
**** mungeHelp.C ****
#include "mungeHelp.H"
static
void destroyWarningDialog(OI_menu_cell *cp,void *arg,OI_number num)
{
cp->parent()->parent()->del();
return;
}
static
void invokeHelp (OI_menu_cell *cellp, void *argp, OI_number button)
{
int pid;
static char command[1024];
static char *filename=MH_HELPPATH;
char *xlatedFilename;
xlatedFilename = OI_translate_filename(filename);
sprintf(command, MH_EXECSTRING, xlatedFilename);
printf("Invoking help...\n");
OI_fork_nowait(command);
return;
}
void
mungeHelp(OI_d_tech *tp)
{
static OI_cell_spec cells[] = {
{"Oh Well", "Oh Well, life goes on", destroyWarningDialog}
};
static char *warnText =
"WARNING: Cannot find '@on_context' in OI object tree.\n"
"Continuing on without access to Frame help.";
OI_menu_cell *helpKey =
(OI_menu_cell *) tp->descendant("@on_context");
if (!helpKey) {
OI_warn_dialog_box *bp = oi_create_warn_dialog_box("warnBox", warnText,
OI_count(cells),
&cells[0]);
bp->set_associated_object(tp->root(), OI_def_loc, OI_def_loc, OI_active);
return;
}
helpKey->set_label("Frame Help");
helpKey->change_action(invokeHelp, NULL);
}
=============================================================================
William D. Mooney | email: wmooney@shl.com or 74353.1325@compuserve.com
| phone: 407.263.3329
SHL Systemhouse, Inc. | fax: 407.260.0590
=============================================================================
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9503091552.AA00286>
