home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / windows / x / 14241 < prev    next >
Encoding:
Text File  |  1992-07-22  |  2.9 KB  |  92 lines

  1. Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!chx400!sicsun!slhp1.epfl.ch!lecom
  2. From: lecom@slhp1.epfl.ch (Claude Lecommandeur)
  3. Newsgroups: comp.windows.x
  4. Subject: Menus and grab, bug ?
  5. Message-ID: <3347@sicsun.epfl.ch>
  6. Date: 22 Jul 92 10:41:20 GMT
  7. Sender: news@sicsun.epfl.ch
  8. Organization: Ecole Polytechnique Federale de Lausanne
  9. Lines: 81
  10.  
  11.  
  12.     I think there is a little bug in Xt or Xaw. If you have a translation that
  13. pops up a menu widget in a composite widget, the menu is poped up not only in
  14. the composite but also in all his sub-widgets (the brothers of the menu). This
  15. make impossible to have popup menus in composites.
  16.     It looks like there is a grab that is inherited by childrens and shouldn't.
  17.  
  18.     A small example show this behaviour :
  19.  
  20. -------------------------------------------------------------------------
  21. #include <stdio.h>
  22.  
  23. #include <X11/Intrinsic.h>
  24. #include <X11/StringDefs.h>
  25. #include <X11/Xaw/Cardinals.h>
  26. #include <X11/Xaw/Command.h>
  27. #include <X11/Xaw/Form.h>
  28. #include <X11/Xaw/SimpleMenu.h>
  29. #include <X11/Xaw/SmeBSB.h>
  30.  
  31. static XtCallbackProc quit ();
  32. static XtCallbackProc ent  ();
  33.  
  34. main (argc,argv)
  35. int  argc;
  36. char **argv;
  37. {
  38.     Widget   toplevel, form, button, menu, entry1, entry2;
  39.  
  40.     toplevel = XtInitialize ("bug", "Bug", NULL, 0, &argc, argv);
  41.     form     = XtCreateManagedWidget ("form", formWidgetClass,  toplevel, NULL, ZERO);
  42.     button   = XtCreateManagedWidget ("button", commandWidgetClass, form, NULL, ZERO);
  43.     XtAddCallback (button, XtNcallback, quit, NULL);
  44.  
  45.     menu   = XtCreatePopupShell  ("menu", simpleMenuWidgetClass, form, NULL, ZERO);
  46.     entry1 = XtCreateManagedWidget ("entry1", smeBSBObjectClass, menu, NULL, ZERO);
  47.     XtAddCallback (entry1, XtNcallback, ent, "entry1");
  48.     entry2 = XtCreateManagedWidget ("entry2", smeBSBObjectClass, menu, NULL, ZERO);
  49.     XtAddCallback (entry2, XtNcallback, ent, "entry2");
  50.  
  51.     XtRealizeWidget (toplevel);
  52.     XtMainLoop ();
  53. }
  54.  
  55. static XtCallbackProc quit (widget, data, junk)
  56. Widget      widget;
  57. char      *data;
  58. XtPointer junk;
  59. {
  60.     printf ("quit\n");
  61. }
  62.  
  63. static XtCallbackProc ent (widget, data, junk)
  64. Widget      widget;
  65. char      *data;
  66. XtPointer junk;
  67. {
  68.     printf ("entry = %s\n", data);
  69. }
  70. -------------------------------------------------------------------------
  71.   with a resource file :
  72.  
  73. Bug.form.translations:        #override\
  74.     <Btn1Down>    : XawPositionSimpleMenu(menu) XtMenuPopup(menu)
  75. -------------------------------------------------------------------------
  76.  
  77.     The quit action never get called, instead the menu is poped up when i click
  78. on the button. Is this a bug, or do i misunderstand something.
  79.     Is there a workaround ?
  80.  
  81.    Thanks for any hints.
  82.  
  83. -- 
  84.  
  85.  
  86.                     Claude Lecommandeur
  87.                     Service Informatique Central
  88.                     Ecole Polytechnique Federale de Lausanne
  89.                     1015 LAUSANNE (SWITZERLAND)
  90.                     E-Mail : lecom@sic.epfl.ch
  91.                     Tel : (41 21) 693-22-97
  92.