X-Alens-uprop: save-for=1 year
Received: by ATHENA-PO-2.MIT.EDU (5.45/4.7) id AA27106; Thu, 5 Oct 89 15:00:36 EDT
Received: from BINKLEY.MIT.EDU by ATHENA.MIT.EDU with SMTP
	id AA07302; Thu, 5 Oct 89 14:59:57 EDT
Received: by BINKLEY.MIT.EDU (5.61/4.7) id AA12463; Thu, 5 Oct 89 14:59:50 -0400
Date: Thu, 5 Oct 89 14:59:50 -0400
Message-Id: <8910051859.AA12463@BINKLEY.MIT.EDU>
From: Barr3y Jaspan <bjaspan@ATHENA.MIT.EDU>
Sender: bjaspan@ATHENA.MIT.EDU
To: rap@ATHENA.MIT.EDU
Cc: motif@ATHENA.MIT.EDU
In-Reply-To: rap@ATHENA.MIT.EDU's message of Thu, 5 Oct 89 14:39:50 -0400 <8910051839.AA16349@MORPHEUS.MIT.EDU>
Subject: setting focus


   From: rap@ATHENA.MIT.EDU
   Date: Thu, 5 Oct 89 14:39:50 -0400

   does anybody know how to excplicitly set the focuus to a widget without
   sending XEvents or calling XtSetKeyboardFocus (which doesn't work) ?

	   THANKS in advance (:->

		   __Rich Pito

XtSetKeyboardFocus() _DOES_ work.. you are trying to make it do
something it is not supposed to.  XtSetKeyboardFocus() allows X events
sent to a hierarchy of widgets to be forwarded to a single widget (for
example, if your mouse is in a dialog box you want key events to go to
the text widget, even if the mouse happens to be over a pushbutton.)

I don't know of an Xt function that explicity sets keyboard focus.
Use XSetInputFocus().  For example:

XSetInputFocus(XtDisplay(TopLevelWidget), XtWindow(widget),
               RevertToParent, CurrentTime);

TopLevelWidget is the widget returned by XtInitialize.  widget is the
widget you want keyboard focus set to.  The last two arguments are
constants.. type "man XSetInputFocus" for more details.

NOTE:  Don't use this function call!!!  The only program that I've
seen that has a good reason to call XSetInputFocus is xscreensaver,
and that is for an unusual reason.  It is generally very rude to force
focus to a certain window.

Barr3y
