[comp.windows.x.motif] Getting the same popup menu on several different windows

alice@athena.mit.edu (Timothy R Wall) (03/19/91)

I have created a popup menu to be posted via button press
(exactly as in the Motif Programmer's Guide) on four
FormDialogs and the application MainWindow.  Each FormDialog
may or may not be managed, but each has a single custom-widget
child (I'll call Plotter).  The MainWindow has a Form widget
for a workarea, and that Form also has a Plotter child.

The popup menu was created as a child of the appshell returned by
XtInitialize.  The popup menu should post on BP from any of the 
Plotter widgets; i.e. I want the same functions to be supplied each
of the five Plotters.  The same managing callback is added as an
event handler for all five Plotter widgets.

The problem is that the menu won't post in the MainWindow;  I
get a right-pointing arrow with a BP (Button3, which PostPopup looks
for) everywhere in the workarea of the MainWindow.  (Do I need to
explicitly set the Form child using XmMainWindowSetAreas?)
However, the popup posts fine with any of the FormDialogs.

What seems to be bizarre is that once I have selected a button from
the popup menu (i.e. activated a callback from the popup), the
menu posts normally in the MainWindow, and I no longer get a right-
pointing arrow elsewhere in the MainWindow.

Help appreciated, trivia maybe.

Timothy Wall
Parsons Lab, MIT
alice@athena.mit.edu

jhc@ivan.uucp (James H. Coombs) (03/20/91)

In article <54435@inkwell.UUCP> jhc@ivan.UUCP (James H. Coombs) writes:
>In article <1991Mar19.061108.7197@athena.mit.edu> alice@athena.mit.edu (Timothy R Wall) writes:
>>....
>>The problem is that the menu won't post in the MainWindow;  I
>>get a right-pointing arrow with a BP (Button3, which PostPopup looks
>>for) everywhere in the workarea of the MainWindow.
>>....
>
>I have a similar problem....

It looks as though I can work around this by destroying the popup when
it is unmapped.  There is a noticeable performance hit, but at least
the basic behavior is correct.

I really don't know what is going wrong here.  One thing that I noticed
is that my popup routine was not being invoked when there were
problems.  It is as if my translation was replaced with some dummy
translation for the entire window.

--Jim

jhc@ivan.uucp (James H. Coombs) (03/21/91)

In article <54436@inkwell.UUCP> jhc@ivan.UUCP (James H. Coombs) writes:
>In article <54435@inkwell.UUCP> jhc@ivan.UUCP (James H. Coombs) writes:
>>In article <1991Mar19.061108.7197@athena.mit.edu> alice@athena.mit.edu (Timothy R Wall) writes:
>>>....
>>>The problem is that the menu won't post in the MainWindow;  I
>>>get a right-pointing arrow with a BP
>
>destroy the popup when it is unmapped.

Ok, here is another solution.  Create a dummy widget to use as the
parent of the popup.  Never manage the dummy widget, just use it as the
parent.  This approach seems to work fine, and it makes it possible to
re-use the popup and its children.

--Jim