From owner-oi-users Thu Mar 9 08:05:40 1995 Return-Path: oi-users-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id IAA12000 for oi-users-outgoing; Thu, 9 Mar 1995 08:05:40 -0800 Received: from houws001.shl.com (houws001.shl.com [159.249.56.252]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id IAA11895 for ; Thu, 9 Mar 1995 08:04:12 -0800 Received: from casws009.shl.com by houws001.shl.com (4.1/SMI-4.1.8) id AA13629; Thu, 9 Mar 95 10:04:10 CST Received: by casws009.shl.com (5.0/SMI-SVR4) id AA00286; Thu, 9 Mar 95 10:52:16 EST Date: Thu, 9 Mar 95 10:52:16 EST From: wmooney@casws009.shl.com (William D. Mooney) Message-Id: <9503091552.AA00286@casws009.shl.com> To: oi-users@freefall.cdrom.com Subject: Re: adding cells to Help menu Cc: wmooney@casws009.shl.com X-Sun-Charset: US-ASCII Content-Length: 3041 Sender: oi-users-owner@FreeBSD.org Precedence: bulk ----- 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 /////////////////////// // 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 =============================================================================