home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / windows / x / motif / 7612 < prev    next >
Encoding:
Text File  |  1992-11-20  |  3.0 KB  |  87 lines

  1. Newsgroups: comp.windows.x.motif
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!haven.umd.edu!darwin.sura.net!wupost!csus.edu!netcom.com!richm
  3. From: richm@netcom.com (Richard Mauri)
  4. Subject: Re: Need subclassing help!?
  5. Message-ID: <1992Nov20.152129.27705@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. References: <4312@cvbnetPrime.COM>
  8. Date: Fri, 20 Nov 1992 15:21:29 GMT
  9. Lines: 76
  10.  
  11. In article <4312@cvbnetPrime.COM> dhukill@esprit.prime.com (Dave Hukill x4056 5-1) writes:
  12. >I'm having a problem with a widget I've subclassed under motif. I get the
  13. >following error:
  14. >
  15. >Warning: 
  16. >    Name: menubar
  17. >    Class: XmRowColumn
  18. >    Attempt to add wrong type child to a homogeneous RowColumn widget
  19. >
  20. >The code looks like this:
  21. >
  22. >      shell = XtAppInitialize(&appContext,
  23. >                  "myWidgetApp",
  24. >                  NULL,
  25. >                  0,
  26. >                  &argc,
  27. >                  argv,
  28. >                  NULL,
  29. >                  NULL,
  30. >                  0);
  31. >
  32. >      menuBar = XmCreateMenuBar(shell,
  33. >                "menubar",
  34. >                NULL,
  35. >                0);
  36. >      XtManageChild(menuBar);
  37. >
  38. >      menuPulldown = XmCreatePulldownMenu(menuBar,
  39. >                      "menuPulldown",
  40. >                      NULL,
  41. >                      0);
  42. >
  43. >      menuItem = XtVaCreateManagedWidget("menu item",
  44. >                     xmPushButtonWidgetClass,
  45. >                     menuPulldown,
  46. >                     NULL);
  47. >      XtAddCallback(menuItem, XmNactivateCallback, menuItemCallback, NULL);
  48. >
  49. >      menuButton = XtVaCreateManagedWidget("menu button",
  50. >                       myMenuButtonWidgetClass,
  51. >                       menuBar,
  52. >                       XmNsubMenuId, menuPulldown,
  53. >                       NULL);
  54. >
  55. >Obviously, my class is 'muMenuButtonWidgetClass'. The strange thing is that
  56. >the widget works properly. I'm running Quest Motif version 1.1.4 on Sun SPARC.
  57. >I've checked and double-checked the class initializations in the class record,
  58. >and they appear to be fine. I've successfully sub-classed this widget under
  59. >OLIT, but other than the 'core' class, they're quite different.
  60. >
  61. >Any input on this problem would be greatly appreciated!
  62. >
  63. >advTHANKSance - 
  64. >Dave Hukill <dhukill@esprit.prime.com>
  65.  
  66. Here are some observations:
  67. 1. Your RowColumn does not explicitly set the XmNisHomogeneous
  68. resource, since you use the menubar convenience function, you
  69. let it set the resource to True for you. Try setting it to
  70. False after creating the menubar.
  71. 2. Normally you add cascade buttons as children of menubar's
  72. but you add a pulldown menu and your myMenuButtonWidgetClass
  73. which are not nomogeneous.
  74. 3. Have you stepped through in synchronous mode to find out
  75. which is the offending call. Sounds like the problem isn't
  76. in your myMenuButtonWidgetClass but it is different than
  77. the first rowcolumn child and as such appears to be you
  78. widget class. It is the row column that is screaming.
  79. 4. Try using homogeneous children of the rowcolumn
  80. or setting the resource to False.
  81. Rich Mauri
  82. -- 
  83. Richard Mauri               // Not ready to face the winter.
  84. SW Eng / X hack             // Pray for wind.
  85. Trimble Navigation Ltd.     // Pay the bills.
  86. richm@netcom.com        // Hope nothing breaks
  87.