[comp.windows.x] Moving keyboard focus in OpenLook

clint@olias.sybase.com (Doug Clinton) (05/24/91)

I have an application which needs to assign keyboard focus to a
specific OpenLook text widget in a form widget. I have tried using
XtCallAcceptFocus(), OlCallAcceptFocus() and OlMoveFocus().

All of these assign keyboard focus to the desired widget but suffer
from the drawback that keyboard input is immediately directed to that
widget regardless to whether the pointer is in the application window
or not.

I have also tried XtSetKeyboardFocus() passing the form as the subtree
and the text widget as the destination. This assigns the focus within
the app without immediately grabbing keyboard input, however I then
find that the normal traversal mechanisms no longer work and I cannot
set focus to any of the other text widgets either by tabbing or
selecting.

So what I am looking for is a way of indicating to the form that input
focus should be directed to a particular child widget the next time
the application gets focus, but not to grab it immediately. Can anyone
help me?

I am using OpenWindows OLIT on a Sun IPC running the OpenWindows
server.


Thanks,

Doug

merlyn@attunix.att.com (Steve Humphrey) (05/30/91)

In article <12958@sybase.sybase.com> clint@olias.sybase.com (Doug Clinton)
writes:

> I have an application which needs to assign keyboard focus to a
> specific OpenLook text widget in a form widget. I have tried using
> XtCallAcceptFocus(), OlCallAcceptFocus() and OlMoveFocus().
> 
> All of these assign keyboard focus to the desired widget but suffer
> from the drawback that keyboard input is immediately directed to that
> widget regardless to whether the pointer is in the application window
> or not.
>
> So what I am looking for is a way of indicating to the form that input
> focus should be directed to a particular child widget the next time
> the application gets focus, but not to grab it immediately.

Set the XtNfocusWidget on the top-level shell of the application.
This resource is implemented by an extension to the (MIT) VendorShell
widget.

> I have also tried XtSetKeyboardFocus() passing the form as the subtree
> and the text widget as the destination. This assigns the focus within
> the app without immediately grabbing keyboard input, however I then
> find that the normal traversal mechanisms no longer work and I cannot
> set focus to any of the other text widgets either by tabbing or
> selecting.

We found that XtSetKeyboardFocus is broken, and were forced to
use the Xlib version. Don't use this routine.

Steve Humphrey
UNIX System Laboratories