Global handler for unhandled keyboard events?

I am binding the EVT_CHAR event of the application to the function,
and I get some of the keystrokes. But when focus is on windows
such as a slider or option buttons, etc. the key events aren't
passed up. I'm hoping I don't have to do custom event handlers
for every specific widget...

···

-----Original Message-----
From: Mike C. Fletcher [mailto:mcfletch@rogers.com]
Sent: Monday, January 27, 2003 11:22 AM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] Global handler for unhandled keyboard
events?

The chain for wxCommandEvent handlers eventually goes to the wxApp if
not handled elsewhere. Bind these types of handlers on the wxApp and
you're golden.

I believe there is also some support for explicit global accellerator
tables, but I haven't used those as-of-yet.

Good luck,
Mike

Jeff Kotula wrote:

Hi again. I'd like to set up a single function as a global accelerator handler.
This handler would be called, ideally, after the normal event-handling stuff
has a chance to handle the keyboard input. This would let me have global
function keys that operated the same regardless of which window had focus
(unless that window ate the input anyway).

Has anyone done anything like this?

-------------------------------------------------------------------------------------
Jeff Kotula Systems Architecture Manager
Vital Images jkotula@vitalimages.com

Although the module is mathematically correct, the solution
is physically impossible. Either that, or you have actually
created mass and I will apologize for underestimating
your power.
  -- Things to Tell Programmers,
      Dilbert Short List

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

________________________________________________________________________
This email has been scanned for all viruses and found to be virus free. If you have questions regarding this scanning please visit the Information Services area of http://home.vitalimages.com
________________________________________________________________________

Jeff Kotula wrote:

I am binding the EVT_CHAR event of the application to the function,
and I get some of the keystrokes. But when focus is on windows
such as a slider or option buttons, etc. the key events aren't
passed up. I'm hoping I don't have to do custom event handlers
for every specific widget...

Well, if the native widget consumes the char then it consumes it. The only thing you can do is intercept it before the native widget gets the event. I expect that any control that is designed to accept focus and do anything with the keyboard will consume the char events, even if it only reacts to a few of them.

I just thought of something else you may be seeing. If the KEY_DOWN is handled (and event.Skip or its equivalent in the native handler) is not called, then there will not be an EVT_CHAR event.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!