home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / windows / x / motif / 8366 < prev    next >
Encoding:
Text File  |  1993-01-06  |  2.1 KB  |  48 lines

  1. Newsgroups: comp.windows.x.motif,80,articles
  2. Path: sparky!uunet!wupost!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watmath!undergrad.math.waterloo.edu!napier.uwaterloo.ca!cpbeaure
  3. From: cpbeaure@napier.uwaterloo.ca (Chris Beauregard)
  4. Subject: Re: controlling an option menu from within the program (summary)
  5. Message-ID: <C0Frr8.Hvz@undergrad.math.waterloo.edu>
  6. Keywords: option menu
  7. Sender: news@undergrad.math.waterloo.edu
  8. Organization: University of Waterloo
  9. References: <1992Dec30.205716.17673@gate.esat.kuleuven.ac.be> <1993Jan6.102718.2140@gate.esat.kuleuven.ac.be>
  10. Date: Wed, 6 Jan 1993 14:18:43 GMT
  11. Lines: 35
  12.  
  13. In article <1993Jan6.102718.2140@gate.esat.kuleuven.ac.be> johanb@joyce.esat.kuleuven.ac.be (Johan Buelens) writes:
  14. >many thanks to everybody who responded !  as jasper@einstein.com pointed
  15. >out, `The menuHistory resource must be set to the XmPushButton *widget* that
  16. >you want to be selected.'
  17. >
  18. >you can use the convenience functions to create the option menu, but then
  19. >you have to find out the names of the pushbutton widgets and the menu widget;
  20. >it then seems more appropriate to create the menu `the hard way' (without 
  21. >convenience function), so you are in control of all the widget names.
  22. [code deleted]
  23.  
  24. While this works, it's a real pain if you have a good number of menus to
  25. deal with.
  26.  
  27. I've written a small (<10 lines of code) to set the button of an option
  28. menu just given the number of the wanted button (0-(n-1), n being the 
  29. number of buttons entries in the menu)  So you can basically use
  30.  
  31.      XmOptionMenuButton(widget,buttonNumber);
  32.  
  33. Unfortunately, the code for the routine is at work.  I'm afraid I can't
  34. telnet there to get it (don't ask...).  
  35.  
  36. Basically you grab the sublist of button widgets (using XtVaGetValues -
  37. I don't remember the resource), and then get the widget id of the 
  38. buttonNumber needed.  Use that when you set menuHistory.  I think you 
  39. might also have to unmanage and manage the widget again.
  40.  
  41. If I get some time today (ugh!) I'll take a quick shot at working the
  42. code out and post it...
  43.  
  44. >Johan H. BUELENS
  45.  
  46. Chris Beauregard                                cpbeaure@napier.uwaterloo.ca
  47. Warning:  These premises protected by reality.
  48.