home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x.motif
- Path: sparky!uunet!unislc!fladmoe
- From: fladmoe@unislc.uucp (Gary Fladmoe)
- Subject: Re: popping up a PopupMenu using Btn1
- References: <C14G2D.Gvu@csn.org>
- Message-ID: <1993Jan22.160053.24231@unislc.uucp>
- Reply-To: fladmoe@unislc.UUCP (Gary Fladmoe)
- Organization: Unisys, Salt Lake City
- Date: Fri, 22 Jan 1993 16:00:53 GMT
- Keywords: popup menu
- Lines: 30
-
- In article <C14G2D.Gvu@csn.org> tom@teal.csn.org (Tom Schutter) writes:
- >I am constructing a toolbar where some buttons do actions when pushed, and
- >others bring up popup menus. To make things consistent, I want the popup
- >menus to come up with Btn1.
- >
- >I start with a RowColumn (of type XmWORK_AREA) with a number of PushButton
- >children. An activate callback on each PushButton then either calls one of
- >my action callbacks or calls XmMenuPosition and XtManageChild to popup a menu.
- >
- >The problem is that Btn1 pops the menu up, but only Btn3 will pop it down.
- >...
-
- The following function violates the rule against using the Widget's private
- data, but it seems to work:
-
- #include <Xm/RowColumnP.h>
- void MenuButtonCB(w, menu, cbs)
- Widget w;
- Widget menu;
- XmAnyCallbackStruct *cbs;
- {
- XButtonPressedEvent *event;
-
- event = (XButtonPressedEvent *)(cbs->event);
- XmMenuPosition(menu, event);
- XtManageChild(menu);
- if (event->type == ButtonPress)
- RC_PostButton(menu) = event->button;
- }
-
-