Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!srhqla!quad1!carl From: carl@quad1.quad.com (Carl Priddy) Newsgroups: comp.windows.x.motif Subject: Re: Multiple callbacks... Summary: multiple callbacks Keywords: This then that... Message-ID: <14288@gouda.quad.com> Date: 6 Aug 90 17:11:09 GMT References: <7@gauss.mmlai.UUCP> Organization: Quadratron Systems Inc, Thousand Oaks Ca Lines: 27 In article <7@gauss.mmlai.UUCP>, burzio@mmlai.UUCP (Tony Burzio) writes: > Does anyone have a short example of how to register > more than one callback for a single event? Well, I am not sure if your problems are caused by the lack of multiple callbacks, but as I found out by accident just recently, the use of XtAddCallback() does just what the name implies: it ADDs a callback. That is, if you enter a loop which calls XtAddCallback() 'n' times with the same widget and arguments, when the event occurs it will invoke that callback 'n' times. -- example -- Widget wl; VOID cbrtn(); int i; .. .. /* * assume that wl is a pushbutton */ for (i = 0; i < 5; i++) XtAddCallback(wl,XmNactivateCallback, cbrtn,i); ... Now, when the button is activated, there will be 5 calls to cbrtn(), with then numbers 0-4 passed as client data. carl.