Re: Win32lib & key trapping

new topic     » goto parent     » topic index » view thread      » older message » newer message

"Grape Vine" wrote:

> If anyone has a example of working win32lib
> key trapping I would be very grateful.

Take a look at IDE_EDIT.EW. There are two seperate key traps - one for
printable characters, and one for navigation characters. Editor_KeyHandler
is hooked to onKeyPress (printable keys), while Editor_KeyPress is hooked to
onKeyDown (raw keys, including navigation).

Because I like to have a single routine handle the keys, Editor_KeyHandler
ends up handling all the keystrokes, including the navigation keys. I do
this through a bit of trickery - raw keys values are set negative, and then
passed to Editor_KeyHandler. I redefine the keys I'm interested in; i.e.:

   KeyReturn = VK_RETURN,
   KeyBack   = VK_BACK,
   KeyEnd    = -VK_END,
   KeyHome   = -VK_HOME,
   KeyUp     = -VK_UP,
   KeyDown   = -VK_DOWN ...

The call to returnValue( True ) probably isn't needed. I'm trapping
keystrokes that are being sent to a (hidden) MLE, and this prevents the MLE
from ever seeing the processed keys.

Hope this helps.

-- David Cuny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu