Getting shell that has focus

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

3 posts / 0 new
Last post
Getting shell that has focus

Submitted by machnone on Mon, 12/17/2001 - 21:46. Developers
Is there a way to tell which shell currently has keyboard/mouse focus?
I know that XmGetFocusWidget can be used to get the current widget with focus, but the shell that the widget is in must be known.
I need to know which shell has focus. I know the XtAppContext I am working with, I just need to know which shell in this app context currently has the focus.
Any help is greatly appreciated.

Anonymous

Use a combo of XtParent() and XtIsShell() to traverse the widget tree until you get to the top where you will find a shell.

-scorch

machnone

Scorch,
That is exactly what I am doing to get the shell when I know which widget has focus.
But, I don`t know which widget has focus, so in order to use XmGetFocusWidget, I need to know which shell to pass it.
There could be any number of shells up when I need to find the widget with focus, so I need to know which shell to start from.