Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!bloom-beacon!ATHENA.MIT.EDU!kit From: kit@ATHENA.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: common routines Message-ID: <8902091719.AA02641@DORA.MIT.EDU> Date: 9 Feb 89 17:19:23 GMT References: <3008@stiatl.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 29 > If I need the same code in several types of widgets (eg, IgnoreChar - > a routine to throw away unwanted characters), do I need a static copy > of this in each widget.c file, or can I just stick a non-static version > in a common library? I suppose that you could declare the function as external in the widget, then add it to the widget's action table. This should cause everything to work correctly. I will leave it to you to figure out how to make sure that the function gets linked into the application. If you are writing an application this is much easier, you just need to add the action routine to your application's AppContext using XtAppAddActions(). The Intrinsics search for an action routine in widget, and then up through all of its superclasses. If it finds the routine it stops searching and uses the one that it found. If it still hasn't found it after searching through all of the widget's superclasses it then looks for any action routines that the application has defined. Chris D. Peterson MIT X Consortium / Project Athena Net: kit@athena.mit.edu Phone: (617) 253 - 1326 USMail: MIT - Room E40-321 77 Massachusetts Ave. Cambridge, MA 02139