[comp.windows.x] bug in ORielly XMenu example

kulkarni@umn-cs.cs.umn.edu (Srinivas R. Kulkarni) (07/19/90)

	I tried making some changes to the Xaw Menu widget programs 
	in the public domain ORielly examples in Chapter 12.

	xmenu7.c compiles and runs just fine as long as you dont change the
	NAME of the 'menu' widget. 

	menu = XtCreatePopupShell("cant_change_this!!", simpleMenuWidgetClass,
                          button, NULL, 0);

	I get the following warning from the PopupMenu procedure:
	  Warning: MenuButton: Could not find menu widget named menu.

	Is the above a bug, a feature, or is it just me?!

converse@EXPO.LCS.MIT.EDU (07/19/90)

> 	I tried making some changes to the Xaw Menu widget programs 
> 	in the public domain ORielly examples in Chapter 12.
> 
> 	xmenu7.c compiles and runs just fine as long as you dont change the
> 	NAME of the 'menu' widget. 
> 
> 	menu = XtCreatePopupShell("cant_change_this!!", simpleMenuWidgetClass,
>                           button, NULL, 0);
>
> 	I get the following warning from the PopupMenu procedure:
> 	  Warning: MenuButton: Could not find menu widget named menu.

Suppose this demo had 3 menu buttons, each with a different menu to pop up.
Where would you indicate the mapping between buttons and menus?  How does
the button "know" which menu to pop up when you press it?  

The answer is that the Athena menu button widget will pop up the menu 
whose name is the same as is given in the menu button's menuName resource,
and the default value of the menuName resource is "menu".  If you change
the name of the popup shell widget without changing the resource value,
the button won't be able to pop up the menu.


Donna Converse