Path: utzoo!attcan!uunet!husc6!bloom-beacon!EXPO.LCS.MIT.EDU!kit From: kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: widget name Message-ID: <8904181920.AA20845@expo.lcs.mit.edu> Date: 18 Apr 89 19:20:55 GMT References: <8904122130.AA02620@hara.fctunl.rccn.pt> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 24 > I am working on an application that uses numerous widgets. For one > of the callback functions of a CommandWidget, I need to know the name > of the widget that called the callback. How can I do this? > Have your callback routine do: > 1) an XtGetValues on the XtNlabel argument (slow but safe) This won't work, the default is to have the label use the name, but if someone adds the line "*Command*label: foo" to their resource file this will screw you over. Label and Name are NOT the same. > 2) use the value of w->core.name. This breaks abstraction barriers, but works. The best thing is to write your own XtWidgetToName() function, so that you can convert over when this function gets added to the Intrinsics. Unfortunatly until this function gets added to the Instrincs there is no way to do this cleanly. Chris D. Peterson MIT X Consortium