Parent document is top of "Motif FAQ (Part 4 of 9)"
Previous document is "95) How do XmTextField and a single line XmText widget differ?"
Next document is "97) Can you reuse the return value from XtParseTranslationTable?"

96) Why does pressing RETURN in a text widget do nothing? This

happens using Motif 1.0 when I have a text widget inside a bulletin board (or
form) inside a dialog shell. (In Motif 1.1 it is fixed for both text and list
widgets.)

Answer:  In single line mode, pressing the <return> key usually invokes the
activate() action, and in multi-line mode, the newline() action.  However,
whenever a widget is the child of a bulletin board widget which is the child
of a dialog shell, the bulletin board forces all of its children to translate
<return> to the bulletin board action Return() which is usually associated
with the default button of the dialog.  To restore the text actions of
activate() or newline(), you need to overide the Return() action of the
bulletin board.


        /* declarations */
        /* for a single line widget */
        char newTrans[] = "<Key>Return : activate()";
        /* for a multi line widget */
        char newTrans[] = "<Key>Return : newline()";
        XtTranslations transTable;

        /* in executable section */

        transTable = XtParseTranslationTable(newTrans);

        /* after creating but before managing text widget */

        XtOverrideTranslations(textWidget, transTable);

Parent document is top of "Motif FAQ (Part 4 of 9)"
Previous document is "95) How do XmTextField and a single line XmText widget differ?"
Next document is "97) Can you reuse the return value from XtParseTranslationTable?"