home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x.motif,80,articles
- Path: sparky!uunet!mcsun!ub4b!news.cs.kuleuven.ac.be!gate!joyce!johanb
- From: johanb@joyce.esat.kuleuven.ac.be (Johan Buelens)
- Subject: Re: controlling an option menu from within the program (summary)
- Message-ID: <1993Jan6.102718.2140@gate.esat.kuleuven.ac.be>
- Keywords: option menu
- Sender: news@gate.esat.kuleuven.ac.be (USENET News System)
- Organization: K.U.Leuven, Belgium
- References: <1992Dec30.205716.17673@gate.esat.kuleuven.ac.be>
- Date: Wed, 6 Jan 1993 10:27:18 GMT
- Lines: 55
-
-
- many thanks to everybody who responded ! as jasper@einstein.com pointed
- out, `The menuHistory resource must be set to the XmPushButton *widget* that
- you want to be selected.'
-
- you can use the convenience functions to create the option menu, but then
- you have to find out the names of the pushbutton widgets and the menu widget;
- it then seems more appropriate to create the menu `the hard way' (without
- convenience function), so you are in control of all the widget names.
-
- the following code fragment does the trick:
-
- /* generate a pulldown menu */
- software_optionsubmenu_volume=XmCreatePulldownMenu(software_rowcol,
- "optionsubmenu",NULL,0);
- /* generate the menu choices */
- for(i=0;i<NUMBER_OF_VOLUMES;i++) {
- software_optionsubmenu_volume_choice[i]=
- XmCreatePushButtonGadget(software_optionsubmenu_volume,
- cardinals[i+1],NULL,0);
- }
- /* manage the pulldown menu */
- XtManageChildren(software_optionsubmenu_volume_choice,NUMBER_OF_VOLUMES);
-
- /* create the option menu */
- compound_string=XmStringCreateSimple("volume ");
- ac=0;
- XtSetArg(args[ac],XmNsubMenuId,software_optionsubmenu_volume); ac++;
- XtSetArg(args[ac],XmNlabelString,compound_string); ac++;
- software_optionmenu_volume=XmCreateOptionMenu(software_rowcol,"optionmenu",
- args,ac);
- /* manage the whole thing */
- XtManageChild(software_optionmenu_volume);
-
-
- this menu can be reset simply by:
-
-
- XtVaSetValues(software_optionmenu_volume,XmNmenuHistory,
- software_optionsubmenu_volume_choice[0],0);
-
-
- thanks again,
-
-
- johan -b
-
-
- ---------------------------
- Johan H. BUELENS
- K.U.Leuven / ESAT / K. Mercierlaan 94 / B - 3001 Heverlee / Belgie
- phone : (32) (16) 20 09 31 ext. 1076
- fax : (32) (16) 22 18 55
- e-mail : johanb@esat.kuleuven.ac.be (preferred)
- buelens@imec.be, fheaa00@blekul11.bitnet
-