home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!chx400!sicsun!slhp1.epfl.ch!lecom
- From: lecom@slhp1.epfl.ch (Claude Lecommandeur)
- Newsgroups: comp.windows.x
- Subject: Menus and grab, bug ?
- Message-ID: <3347@sicsun.epfl.ch>
- Date: 22 Jul 92 10:41:20 GMT
- Sender: news@sicsun.epfl.ch
- Organization: Ecole Polytechnique Federale de Lausanne
- Lines: 81
-
-
- I think there is a little bug in Xt or Xaw. If you have a translation that
- pops up a menu widget in a composite widget, the menu is poped up not only in
- the composite but also in all his sub-widgets (the brothers of the menu). This
- make impossible to have popup menus in composites.
- It looks like there is a grab that is inherited by childrens and shouldn't.
-
- A small example show this behaviour :
-
- -------------------------------------------------------------------------
- #include <stdio.h>
-
- #include <X11/Intrinsic.h>
- #include <X11/StringDefs.h>
- #include <X11/Xaw/Cardinals.h>
- #include <X11/Xaw/Command.h>
- #include <X11/Xaw/Form.h>
- #include <X11/Xaw/SimpleMenu.h>
- #include <X11/Xaw/SmeBSB.h>
-
- static XtCallbackProc quit ();
- static XtCallbackProc ent ();
-
- main (argc,argv)
- int argc;
- char **argv;
- {
- Widget toplevel, form, button, menu, entry1, entry2;
-
- toplevel = XtInitialize ("bug", "Bug", NULL, 0, &argc, argv);
- form = XtCreateManagedWidget ("form", formWidgetClass, toplevel, NULL, ZERO);
- button = XtCreateManagedWidget ("button", commandWidgetClass, form, NULL, ZERO);
- XtAddCallback (button, XtNcallback, quit, NULL);
-
- menu = XtCreatePopupShell ("menu", simpleMenuWidgetClass, form, NULL, ZERO);
- entry1 = XtCreateManagedWidget ("entry1", smeBSBObjectClass, menu, NULL, ZERO);
- XtAddCallback (entry1, XtNcallback, ent, "entry1");
- entry2 = XtCreateManagedWidget ("entry2", smeBSBObjectClass, menu, NULL, ZERO);
- XtAddCallback (entry2, XtNcallback, ent, "entry2");
-
- XtRealizeWidget (toplevel);
- XtMainLoop ();
- }
-
- static XtCallbackProc quit (widget, data, junk)
- Widget widget;
- char *data;
- XtPointer junk;
- {
- printf ("quit\n");
- }
-
- static XtCallbackProc ent (widget, data, junk)
- Widget widget;
- char *data;
- XtPointer junk;
- {
- printf ("entry = %s\n", data);
- }
- -------------------------------------------------------------------------
- with a resource file :
-
- Bug.form.translations: #override\
- <Btn1Down> : XawPositionSimpleMenu(menu) XtMenuPopup(menu)
- -------------------------------------------------------------------------
-
- The quit action never get called, instead the menu is poped up when i click
- on the button. Is this a bug, or do i misunderstand something.
- Is there a workaround ?
-
- Thanks for any hints.
-
- --
-
-
- Claude Lecommandeur
- Service Informatique Central
- Ecole Polytechnique Federale de Lausanne
- 1015 LAUSANNE (SWITZERLAND)
- E-Mail : lecom@sic.epfl.ch
- Tel : (41 21) 693-22-97
-