home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / windows / x / motif / 8760 < prev    next >
Encoding:
Text File  |  1993-01-22  |  1.4 KB  |  43 lines

  1. Newsgroups: comp.windows.x.motif
  2. Path: sparky!uunet!unislc!fladmoe
  3. From: fladmoe@unislc.uucp (Gary Fladmoe)
  4. Subject: Re: popping up a PopupMenu using Btn1
  5. References: <C14G2D.Gvu@csn.org>
  6. Message-ID: <1993Jan22.160053.24231@unislc.uucp>
  7. Reply-To: fladmoe@unislc.UUCP (Gary Fladmoe)
  8. Organization: Unisys, Salt Lake City
  9. Date: Fri, 22 Jan 1993 16:00:53 GMT
  10. Keywords: popup menu
  11. Lines: 30
  12.  
  13. In article <C14G2D.Gvu@csn.org> tom@teal.csn.org (Tom Schutter) writes:
  14. >I am constructing a toolbar where some buttons do actions when pushed, and
  15. >others bring up popup menus. To make things consistent, I want the popup
  16. >menus to come up with Btn1.
  17. >I start with a RowColumn (of type XmWORK_AREA) with a number of PushButton
  18. >children. An activate callback on each PushButton then either calls one of
  19. >my action callbacks or calls XmMenuPosition and XtManageChild to popup a menu.
  20. >The problem is that Btn1 pops the menu up, but only Btn3 will pop it down.
  21. >...
  22.  
  23. The following function violates the rule against using the Widget's private
  24. data, but it seems to work:
  25.  
  26. #include <Xm/RowColumnP.h>
  27. void MenuButtonCB(w, menu, cbs)
  28. Widget w;
  29. Widget menu;
  30. XmAnyCallbackStruct *cbs;
  31. {
  32.         XButtonPressedEvent *event;
  33.  
  34.         event = (XButtonPressedEvent *)(cbs->event);
  35.         XmMenuPosition(menu, event);
  36.         XtManageChild(menu);
  37.         if (event->type == ButtonPress)
  38.                 RC_PostButton(menu) = event->button;
  39. }
  40.  
  41.