home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x.motif
- Path: sparky!uunet!think.com!paperboy.osf.org!paperboy!drand
- From: drand@spinner.osf.org (Douglas S. Rand)
- Subject: Re: popping up a PopupMenu using Btn1
- In-Reply-To: fladmoe@unislc.uucp's message of Fri, 22 Jan 1993 16:00:53 GMT
- Message-ID: <DRAND.93Jan22174724@spinner.osf.org>
- Sender: news@osf.org (USENET News System)
- Organization: Open Software Foundation
- References: <C14G2D.Gvu@csn.org> <1993Jan22.160053.24231@unislc.uucp>
- Date: 22 Jan 93 17:47:24
- Lines: 43
-
- In article <1993Jan22.160053.24231@unislc.uucp> fladmoe@unislc.uucp (Gary Fladmoe) writes:
-
- 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;
- }
-
-
- Naughty, naughty, playing with a widget's privates :) . Seriously,
- don't do this. This is not the only thing which must happen. That is
- why there is a data abstraction layer between you and the widget
- internals.
-
- --
- Douglas S. Rand <drand@osf.org> OSF/Motif Dev.
- Snail: 11 Cambridge Center, Cambridge, MA 02142
- Disclaimer: I don't know if OSF agrees with me... let's vote on it.
- Amateur Radio: KC1KJ
-