Re: Key Trapping in win32lib

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

J Reeves wrote:


> I assume the onKeyPress is a key is held down??

Yes, and onKeyRelease is the release of a key.

> Doing this in dos was faster, Once you figured out how....

Everyone's a critic. blink

Actually, the onKeyPress and onKeyRelease are very much like getting raw
information in DOS - they return the scan code.

The project I'm currently writing unifies the two like this:

   procedure OnKeyPress( integer key, integer mask )
      Key( key, mask, True )
   end procedure
   onKeyPress[Win] = routine_id("OnKeyPress")

   procedure OnKeyDown( integer key, integer mask )
      Key( key, mask, False )
   end procedure
   onKeyDown[Win] = routine_id("OnKeyDown")

The key processing code looks something like:

   procedure Key( integer key, integer mask, integer raw )
      if key = 'a' and not raw then
         -- trapping a character

      elsif key = VK_PRIOR and raw then
         -- handle page up

      end if

   end procedure

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