[comp.windows.x] text selection

clyne@redcloud.ucar.edu (John Clyne) (07/22/89)

I would like to have a callback procedure invoked whenever a user selects
a portion of text from a Text Widget (Athena Widget Set). The callback
should return the selected text. Is there a simple way to do this? How? 
I had less trouble with X11 color models. 8-)


Thanks much - jc

	John Clyne 	(clyne@bierstadt.ucar.edu)
	c/o
	National Center for Atmospheric Research
	P.O. Box 3000
	Boulder, Colorado 80307
	(303) 497-1236

	
		%%% Its a small world. But I wouldn't want to paint it %%%
						S. Wright
		%%%						       %%%

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (07/26/89)

> I would like to have a callback procedure invoked whenever a user selects
> a portion of text from a Text Widget (Athena Widget Set). The callback
> should return the selected text. Is there a simple way to do this? How? 

How about adding your own action like this:

<Btn1Up>:	extend-end(PRIMARY, CUT_BUFFER0) MyAction() \n\
<Btn3Up>:	extend-end(PRIMARY, CUT_BUFFER0) MyAction()
 

Since actions are called in order there should always be a good selection
when you action routine is called.  Of course, if the user modified his
translation table then your action may not be called.


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213