[comp.windows.x] Help with Athena Widgets using Text Widgets

radoslav@kuling.UUCP (Radoslav Bogdanovic) (12/13/89)

I need some help with Athena Widgets using text widgets.

I want to have one text window open for error messages etc to
appear in as they come. One sort of dump window for various text
messages. I have seen several examples of using text widgets, but
all was just using predefined static strings or from file. I want
to know how to do to have different strings (texts) to appear in
the text widget. How do the X Window system know when to update 
the screen when I have copied the new text into the assigned string.

Please send me some example on this or just answer.

Thanks in advance!
-- 
____________________________________________________________________________
Radoslav (Raddo) Bogdanovic  - RadoSoft       | radoslav@kuling.docs.uu.se |
Dept. of Computer Systems, Uppsala University | radoslav@cdg.docs.uu.se    |
----------------------------------------------------------------------------

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (12/29/89)

> I want to have one text window open for error messages etc to
> appear in as they come. One sort of dump window for various text
> messages. I have seen several examples of using text widgets, but
> all was just using predefined static strings or from file. I want
> to know how to do to have different strings (texts) to appear in
> the text widget. How do the X Window system know when to update 
> the screen when I have copied the new text into the assigned string.

The easiest way to modify the text in a pre-R4 Athena Text widget is to use the
convience function XtTextReplace().  The function will take a section of text
displayed and replace it with some new text.  The new and replaced strings need
not be of the same lenght, so you can also use this function to add or remove
text.

NOTE: 	This funtion will only work with text widgets that have their editType
	resources set to editable.  If you do not want to allow the user to 
	edit the text, just modify the Translation table to remove all 
	functions that will allow editing.

Remember that pre-R4 Athena Text widgets use the string in place, so a buffer
must be allocated that is big enough to contain all the text that you want the
widget to contain.  For continous displays this is usually accomplished by
eventually removing the text at the beginning of the buffer to make room for the
new text at the end of the buffer.


						Chris D. Peterson     
						MIT X Consortium 

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