Fwd: X11 question: setting widget focus policy

Vaughn Treude plug-devel@lists.PLUG.phoenix.az.us
Tue Oct 29 09:25:02 2002


Hello again:
	If you've already seen this message, please excuse the repost, but as Alan 
D. pointed out to me, I'd basically posted it to the wrong list.  Thanks.

Vaughn


----------  Forwarded Message  ----------
Subject: X11 question: setting widget focus policy
Date: Tue, 29 Oct 2002 06:14:03 -0500
From: Vaughn Treude <vltreude@deru.com>
To: plug-discuss@lists.plug.phoenix.az.us


Hello all:
	Are there any X gurus out there?  I'm new to X programming, having spent
most of my GUI programming time in Visual Studio.  Anyway, I'm trying to
implement a global hotkey in a plain old X program.  (I don't want to use Qt
or Gtk because I want it to be as portable as possible; plus it's not a very
complicated application so I'd like to avoid that crazy "meta object" stuff
for the time being.)  I've set up a translation table for my top-level widget
with the XtVaAppInitialize call.  Its syntax looks fine according to what
I've seen in X programming articles on the web.  I'm successfully capturing
the ButtonDown and ButtonUp events (mouse clicks) and am also trying to
capture the KeyPress and KeyRelease events.  But for some reason those
keyboard event handlers never get executed.  My guess is that the top-level
widget isn't set up to accept keyboard focus, being it only has buttons and
no text-entry widgets on it.  It should be possible to set its properties to
accept a keystroke, right?  I know there are calls like this to set the
"focus policy" of the basic QWidget class in Qt.  Is there a way to do this
in plain old Xt calls?  I have looked at the Widget definition in the X11R6
header files, but nothing in there seems to relate to keyboard focus.  For
the moment, I'm stuck here.  Any ideas?  Thanks!

Vaughn Treude
Nakota Software, Inc.

-------------------------------------------------------