Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!ico!auto-trol!marbru From: marbru@auto-trol.UUCP (Martin Brunecky) Newsgroups: comp.windows.x.motif Subject: Re: callbacks for text widget Keywords: text,callback,reason Message-ID: <829@auto-trol.UUCP> Date: 17 Sep 90 15:40:39 GMT References: <14983@gouda.quad.com> <1990Sep16.004605.9095@relay.wpd.sgi.com> Reply-To: marbru@auto-trol.UUCP (Martin Brunecky) Organization: Auto-trol Technology, Denver Lines: 36 In article <1990Sep16.004605.9095@relay.wpd.sgi.com> mikey@sgi.com writes: >In article <14983@gouda.quad.com>, carl@quad1.quad.com (Carl Priddy) writes: >|> I have experienced some odd behavior with the text widget. I have a popup >|> ....... The documentation CLAIMS that the event >|> that caused the callback is put into the callback struct, but it is >|> consistently zero. > >Next, what kind of callback for the XmText widget are you using to >determine that the user depressed button 2? It's very possible that >the event field of XmAnyCallbackStruct isn't being set to the button >event. I noticed that this is also true when the user pastes the >current selection into a text field ..... > >Lastly, you can solve your problem by using XtAddEventHandler to watch >for button press events on the text widget. > Since XmText callbacks may be triggered by other "things", it is not quite appropriate to trust to the event field. In my WsText widget I solved the problem by additional structure member(s), which try to describe what triggered the callback. May be a usefull enhancement to XmText. [ Plus, I am a firm believer that Xt was invented to RELIEF an application programmer from looking at X events. Thus, even though Motif blindly follows DECwindows in passing events to the callback, I don't ever use those. One of reasons of having a widget is to hide underlying X input system from an application. This, however, puts a little more responsibility on a widget writer, so that applications don't have to compensate for poor widget by knitting a whole net of workarounds based on X calls around it]. -- =*= Opinions presented here are solely of my own and not those of Auto-trol =*= Martin Brunecky marbru@auto-trol.COM (303) 252-2499 {...}ncar!ico!auto-trol!marbru Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404