dmh@goanna.oz.au (Darren Hosking) (04/11/90)
Is it possible to have a client notified of a selection in an AsciiText widget? If so, how would it be done? I do not want to change the translations as the default ones do exactly what I want and I would have to include much of the same code in my action function. I thought about looking up the default translations in the source code and then setting up my own translation that includes the default actions plus my own but I could not find an obvious declaration of the defaultTranslations for the AsciiText widget. Thanks in advance, dmh Darren Hosking ACSnet: dmh@goanna.oz Department Of Computer Science ARPA: dmh%goanna.oz.au@uunet.uu.net RMIT CSNET: dmh%goanna.oz.au@australia GPO Box 2476V UUCP: ...!uunet!goanna.oz.au!dmh Melbourne Vic., Australia 3001
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (05/09/90)
> Is it possible to have a client notified of a selection in an AsciiText widget? Yes. > If so, how would it be done? Read on :-) > I do not want to change the translations as the default ones do exactly what > I want and I would have to include much of the same code in my action > function. You actually do what to change the translations, you need to add a new action routine that is called when there is a valid selection. This action routine can be bound to the same events that trigger the selection. Thus you would modify your translation table to look like this. <Btn1Up>: extend-end(PRIMARY, CUT_BUFFER0) NotifyNewSelection()\n\ <Btn3Up>: extend-end(PRIMARY, CUT_BUFFER0) NotifyNewSelection()\ You may have to build some smarts into the NotifyNewSelection routine if you do not want to be notified when the selection is removed (done by clicking button 1 without dragging). > I thought about looking up the default translations in the source code > and then setting up my own translation that includes the default actions > plus my own but I could not find an obvious declaration of the > defaultTranslations for the AsciiText widget. The default translations are in the file TextTr.c Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213