home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x.motif
- Path: sparky!uunet!centerline!noc.near.net!inmet!reatta!mep
- From: mep@reatta.camb.inmet.com (Mark Polhamus)
- Subject: button3 -> popup menu?
- Message-ID: <1992Aug25.205458.4927@inmet.camb.inmet.com>
- Sender: news@inmet.camb.inmet.com
- Nntp-Posting-Host: reatta
- Organization: Intermetrics Inc.
- Date: Tue, 25 Aug 1992 20:54:58 GMT
- Lines: 110
-
- I'm trying to use an event handler to bring up a popup menu from an
- XmDrawnButton widget on a mouse button 3 press. This usually works, but
- in certain cases the mouse button 3 event is not delivered.
-
- Here's the (approximate) code used to set up the handler:
-
- /*ARGSUSED*/
- static void
- event_handler(pb, client_data, event)
- Widget pb;
- XtPointer client_data;
- XButtonPressedEvent *event;
- {
- ESS_ITEM_TYPE *item;
- Widget menu;
-
- if (event->button != 3 ) {
- return;
- }
-
- XmMenuPosition(menu, event);
- XtManageChild(menu);
- }
-
- ...
- XtAddEventHandler(widget, ButtonPressMask, False,
- event_handler, (XtPointer)NULL);
- ...
-
- I'll sketch out the widget hierarchy below. (I would show some source
- code, but I'm using TeleUSE to generate the widget hierarchy (only) and
- the generated .c file reads poorly)
-
- ApplicationShell
- XmMainWindow
- XmMenubar
- XmCascadeButton
- XmCascadeButton
- XmPulldownMenu
- XmPushButton
- XmPulldownMenu
- XmPushButton
- XmForm
- XmForm
- XmRowColumn
- XmForm
- XmDrawnButton
- XmText
- XmText
- XmForm
- XmDrawnButton
- XmText
- XmText
- XmRowColumn
- XmLabel
- XmLabel
- XmLabel
- XmLabel
- XmScrolledWindow
- XmBulletinBoard
- XmForm
- XmDrawnButton
- XmText
- XmText
-
- TopLevelShell
- XmMainWindow
- XmMenuBar
- XmForm
- XmForm
- XmPushButton
- XmPushButton
- XmScrolledText
- XmScrolledWindow
- XmBulletinBoard
- XmForm
- XmDrawnButton*
- XmText
- XmText
-
-
- All of the XmDrawnButton widgets have the ButtonPressed event handler
- registered. Only the last one (with asterisk) is getting any mouse
- button 3 events, they all get mouse button 2 events.
-
- In addition, when I press mouse button 3 within the ApplicationShell's
- window (not the popup TopLevelShell), the cursor changes to slant to the
- right for a short time, then changes back.
-
-
- Questions:
-
- - Who's stealing my mouse button 3 pressed event? (presumably the
- same agent changing the cursor)
-
- - Is there a better way to bring up a popup menu for an arbitrary
- widget? I'm using the method suggested in O'Reilly's volume six
- (_Motif Programming Manual for OSF/Motif Version 1.1_ by Dan Heller)
- in Chapter 16, Pp. 560.
-
- - Although Heller warns that catching arbitrary events may interfere
- with standard widget behavior, He says that Button 3 events are
- safe since Motif doesn't use it. Has this changed? (We are using
- Motif 1.1)
-
- (if you've read this far, thanks for your consideration!)
-
-
- -- Mark Polhamus
- -- mep@inmet.inmet.com
-