[comp.windows.x.motif] XmNactivateCallback on XmText not being called?

cont1@tse.uucp (Contractor #1 = Tim Horton) (09/20/90)

I am having a consistent problem on several platforms with...
	- text widget,
	- XmSINGLE_LINE_EDIT mode,
	- no translations at all
Editing and selection works roughly as expected, but XmNactivateCallback
does not get called when the user hits return.  Why?

(because I'm a dummy, right?  true, but that's NOT the answer I need.)

This text occurs on a XmFormDialog, which also contains an XmLabel, an
XmDrawingArea and XmScrollBar, 3 XmRowColumn's of XmToggleButtonGadgets,
and a few XmPushButtons.  I don't have any tab groups set (should I?).
The UIL for the widget says it all:
    arguments
	{
	XmNtopAttachment	= XmATTACH_POSITION;
	XmNtopPosition		= posEntryT;
	XmNleftAttachment	= XmATTACH_POSITION;
	XmNleftPosition		= posEntryL;
	XmNrightAttachment	= XmATTACH_POSITION;
	XmNrightPosition	= posEntryR;
	!
	XmNeditable		= true;
	XmNeditMode		= XmSINGLE_LINE_EDIT;
	XmNrows			= 1;
	XmNmaxLength		= 30;
	};
    callbacks
	{
	XmNactivateCallback	= procedure symSelTyped();
	};


There must be something I just don't understand.  Please help.

dbrooks@osf.org (David Brooks) (09/21/90)

In article <1990Sep20.163058.11712@tse.uucp>, cont1@tse.uucp (Contractor
#1 = Tim Horton) writes:
|> 
|> I am having a consistent problem on several platforms with...
|> 	- text widget,
|> 	- XmSINGLE_LINE_EDIT mode,
|> 	- no translations at all
|> Editing and selection works roughly as expected, but
XmNactivateCallback
|> does not get called when the user hits return.  Why?

This one belongs right at the top of the Commonly Asked Questions
list.  Your text widget is in a Form, which is a subclass of
BulletinBoard, which has stolen the Return event to activate its own
default button, even if it doesn't have one.

The cure is to add a translation to the text widget any time after it
has been created, like this:

  XtOverrideTranslations(textWidget,
			 XtParseTranslationTable("<Key>Return: activate()"));

IMPORTANT ANNOUNCEMENT: in everybody's favorite change, this will no
longer be necessary in Motif release 1.1.  To the disgust of the
strict-
encapsulation fans, BulletinBoard will let Text or List children see
the Return key before it looks at it itself.
-- 
David Brooks				dbrooks@osf.org
Systems Engineering, OSF		uunet!osf.org!dbrooks
A Loaf of Bread, a Jug of Wine, and Six Spades Redoubled -- Omar
somebody.

tjhorton@ai.toronto.edu ("Timothy J. Horton") (10/01/90)

  [ sorry if this makes it out in triplicate; we had a broken news Q for days ]


As cont1@tse.UUCP (Contractor #1 = Tim Horton) I wrote:
>
>I am having a consistent problem on several platforms with...
>	- text widget,
>	- XmSINGLE_LINE_EDIT mode,
>	- stricly default translations
>Editing in the text widget works as expected, *BUT* the XmNactivateCallback
>does not get called when the user hits return.  Why?


I've narrowed the problem down -- it has something to do with the enclosing
dialog shell, but I can't guess what:

The XmNactivateCallback DOES get called as expected if the XmText is in a
simple XmForm widget, under my topLevel window, but it DOES NOT get called
if the XmText is in a XmFormDialog, ie. under a dialog shell.

I checked the dialog shell, and XmNdefaultButton is null, and XmNautoUnmanage
is false, so I have no idea why the text widget is not getting the return key.

I know I could add an extra button beside the text field to get an activate
event that way, but I would like `return' to work as it "should", according
to our GUI specification.


>This XmText occurs on a XmFormDialog, which also contains an XmLabel, an
>XmDrawingArea and XmScrollBar, 3 XmRowColumn's of XmToggleButtonGadgets,
>and a few XmPushButtons.  I don't have any tab groups set (should I?).
>The UIL for the text widget says it all:
>    arguments
>	{
>	... position info ...
>	XmNeditable		= true;
>	XmNeditMode		= XmSINGLE_LINE_EDIT;
>	XmNrows			= 1;
>	XmNmaxLength		= 30;
>	};
>    callbacks
>	{
>	XmNactivateCallback	= procedure symSelTyped();
>	};