Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bellcore!snoopy!ik From: ik@ctt.bellcore.com (Ik Su Yoo) Newsgroups: comp.windows.x.motif Subject: Re: How do I bind multiple functions to a buttonpress? Message-ID: <1991Apr7.145215.23017@bellcore.bellcore.com> Date: 7 Apr 91 14:52:15 GMT References: <922@edstip.EDS.COM> <1991Apr5.175019.14043@cs.tcd.ie> Sender: usenet@bellcore.bellcore.com (Poster of News) Reply-To: ik@ctt.bellcore.com (Ik Su Yoo) Organization: Bell Communications Research Lines: 34 In article <1991Apr5.175019.14043@cs.tcd.ie>, cjmchale@cs.tcd.ie (Ciaran McHale) writes: > In <922@edstip.EDS.COM> kevin@edstip.EDS.COM (Kevin Brown) writes: > > >Using Motif 1.0 and X11R4, is it possible to bind multiple functions > >to one button press event. I know that twm contains a function called > >f.function, which allows the user to name and create a function. Is > >there an equivalent in Motif? > > Use XtAddCallback() to bind function foo to the ButtonPress event on a > widget. Then use XtAddCallback() again to bind function bar to the > widget for the same event type. Guess what? Both functions (foo and bar) > will be invoked (in order of their binding) when the button is > pressed in the widget. Amazing, isn't it :-) > > And now for my next trick ... :-) > You have the right idea but wrong context. I think the original poster wanted to bind multiple window manager functions to an event. The trick is to have an event bound to more than one function. For example: Buttons MyButtonBindings { title f.raise title f.beep } This worked under Motif1.1/X11R4/SUN. I haven't seen this "feature" in mwm man page, but it's been a while since I read it :-) Ik Su Yoo RRC 1H-229, (908) 699-5764 ik@ctt.bellcore.com