Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!mips!sgi!shinobu!odin!sgihub!dragon!eukanuba.wpd.sgi.com!mikey From: mikey@eukanuba.wpd.sgi.com (Mike Yang) Newsgroups: comp.windows.x.motif Subject: Re: callbacks for text widget Keywords: text,callback,reason Message-ID: <1990Sep16.004605.9095@relay.wpd.sgi.com> Date: 16 Sep 90 00:46:05 GMT References: <14983@gouda.quad.com> Sender: news@relay.wpd.sgi.com ( CNews Account ) Reply-To: mikey@sgi.com Organization: Silicon Graphics, Inc. Lines: 31 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 |> dialog that contains a text widget. The purpose of this is to allow the user |> to input a file name.If the user depresses the middle (2) button in the |> text widget when it is empty, then I popup a FileSelection widget. The user |> then selects the file and I copy it to the text widget. Unfortunately, the |> file selection box pops up twice. This is apparently once for the button |> down, and once for the button up. The documentation CLAIMS that the event |> that caused the callback is put into the callback struct, but it is |> consistently zero. First of all, overloading the meaning of button 2 could be dangerous. For instance, supposed I select some text somewhere else for the file name, go to your text widget (which is empty), and press button 2 to paste it? Perhaps you should use another mouse button, like 3. 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 -- the valueChanged callback is called but the event shows no indication of the button event. This would be useful for determining whether the user pressed a key or whether the user pasted the current selection. Lastly, you can solve your problem by using XtAddEventHandler to watch for button press events on the text widget. ----------------------------------------------------------------------- Mike Yang Silicon Graphics, Inc. mikey@sgi.com 415/335-1786