[comp.windows.x] SUMMARY: Return in Text Widget

arm@sps.com (Annette Myjak) (08/04/90)

SUCCESS AT LAST!!

THANKS to the many netters who offered suggestions on how to get this to work.

Apparently, whenever some widget is the child of a bulletin board widget
who just happens to be the child of a dialog shell, the bulletin board forces
all of its children to translate <RETURN> to an "activate the default button"
action.  (This is a "feature".)

Thus the reason that although a multiline text widget has <RETURN> = newline()
in its translation table, the <RETURN> doesn't appear to work if the text
widget is in a form dialog (as in my particular case).

The solution is to override the translations to enable the text widget to
recognize <RETURN> as a true <RETURN> (ie, newline).

Special thanks to David Rudolph who supplied the following example code to
show how to do this (as I found out, WHEN you do this is very important!)

(This code is reproduced without David's permission.  I hope he doesn't mind!)


	(in declarations)

	char newTrans[] = "<Key>Return : newline()";
	XtTranslations transTable;

	(after declarations)

	transTable = XtParseTranslationTable(newTrans);

	(after creating but BEFORE managing text widget)

	XtOverrideTranslations(textWidget, transTable);


Since I am using UIL to specify my widgets, I had to modify the
creationCallback of my text widget to set a global variable so that
I could access it again from within the application code to override
its translations.


Again, many thanks.

annette myjak
arm@sps.com