[comp.windows.x] Problems with the SimpleMenu

cameron@cs.flinders.oz.au (Cameron Humphries) (06/01/90)

Hi,

   I am trying to convert a program I wrote using X11R3 to X11R4. The major
change necessary is the use of the SimpleMenu rather than the "box full of
buttons" that I used previously.

   The development is occuring on a Sun4 under SunOS 4.0.3 with X11R4 (patches
1-9 applied).

   The following is some of the code used for the menu:
   
/* part of translation table for a viewport widget */
<Btn3Down>:XawPositionSimpleMenu(menu) MenuPopup(menu)\n\

/* menu is created statically */
menuW = XtCreatePopupShell("menu",simpleMenuWidgetClass,toplevel,NULL,0);

newW = XtCreateManagedWidget("new",smeBSBObjectClass,menuW,newargs,
                               XtNumber(newargs));
/* plus a few more entries */


/* used in creation of the menu entry above */
static XtCallbackRec newcallback[] = {
  {select_new,"new"},
  {NULL,NULL},
};

static Arg newargs[] = {
  {XtNlabel,(XtArgVal)"New"},
  {XtNcallback,(XtArgVal)newcallback},
};


When I run the program (BTW,its a graphical editor for soliton circuits)
everything goes along fine until I try and popup the menu. I press the 3rd
button and sure enough the menu pops up right under the cursor. However I
cannot highlight any entries which of course means I cannot select any
entries. 

Any help would be appreciated.

Cameron Humphries
Discipline of Computer Science                 email: cameron@cs.flinders.oz.au
School of Information Science and Technology   phone: +61 +8 201 2874
The Flinders University of South Australia     fax  : +61 +8 201 2904

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (06/01/90)

>   I am trying to convert a program I wrote using X11R3 to X11R4. The major
> change necessary is the use of the SimpleMenu rather than the "box full of
> buttons" that I used previously.

>    The development is occuring on a Sun4 under SunOS 4.0.3 with X11R4 (patches
> 1-9 applied).

>   The following is some of the code used for the menu:
	
> /* part of translation table for a viewport widget */
> <Btn3Down>:XawPositionSimpleMenu(menu) MenuPopup(menu)\n\

This seems just fine.  I have code very similar to this in my applications.  The
problem appears to be that the grab is not getting activated.  Often this is
caused when some modifiers are set on your button press.  The Translation table
defaults to a "don't care" about the modifiers, while the grab mechanism must
have an exact match.  If this is actually the case, it should affect all menus
on your display.  Are the popup menus in xterm working correctly?  If not then
possibly you have some modifier set that is not affecting you.  I have seen this
happen with the Num Lock key on some displays.

An example for the rest of you: 

Try using SHIFT-CTRL to pop up the menus in xterm.  The menu will popup just
fine, but the items will not be selectable.  

If this is not the problem then I suppose you should send me a SHORT example
program that demonstrates the bug, and I will see what I can do.


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213