[comp.windows.x] AsciiString Widget behaviour

mark@drd.UUCP (Mark Lawrence) (09/13/88)

I just discovered something that sort of surprised me about AsciiString
widgets.

I created a matrix of stringwidgets in a form.  I created a matrix of
strings:

	static char *cellstrings[MAXCOLUMNS][MAXROWS]

which I used to init my widgets thus:

	n = 0;
	XtSetArg(arg[n],XtNstring,cellstrings[i][j]); n++;
	XtSetArg(arg[n],XtNlength,strlen(cellstrings[i][j])); n++;
	XtSetArg(arg[n],XtNeditType,XttextEdit); n++
	cell[i][j] = XtCreateManagedWidget("cell", asciiStringWidgetClass,
						form, arg, n);

When I run the application and edit a cell, I discover that the editted
text shows up in my cellstrings matrix.  I assumed that I would have to
query widget state via XtGetValues to get at the editted string.  Can I
depend on the behaviour I've observed or is the latter the canonical way
to go about it?

			Mark
-- 
 DRD Corporation @ 5506 South Lewis  |   [uunet!apctrc,romed,tulsun]!drd!mark
 Tulsa, IT 74105      (918)743-3013  |       mlawrence@jarsun1.ZONE1.COM

swick@ATHENA.MIT.EDU (Ralph R. Swick) (09/13/88)

     Date:  12 Sep 88 19:50:52 GMT
     From:  okstate!romed!drd!mark@rutgers.edu  (Mark Lawrence)

     When I run the application and edit a cell, I discover that the editted
     text shows up in my cellstrings matrix.  I assumed that I would have to
     query widget state via XtGetValues to get at the editted string.  Can I
     depend on the behaviour I've observed or is the latter the canonical way
     to go about it?

The Xaw/AsciiString widget chooses not to copy the client-supplied
string, but rather to use it in-place.  This behavior is not likely
to change (and will be better documented sometime :-).