[futurebasic] Re: [FB] Key Trapping INIT

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 1999 : Group Archive : Group : All Groups

From: Paul Bruneau <paul_bruneau@...>
Date: Mon, 26 Jul 1999 08:37:44 -0400
Key trapping sounds cool, but have you considered simply changing the
KCHR resource in your system file with ResEdit to remap the forward
delete character ($7F) to your function key? It's click and drag, even.

PB

Mel Patrick wrote:
> 
> Hopefully someone can help out here a little (where's Mars when you
> need him...;-)
> 
> I'm wrote an extension to trap the key events and to a point I have
> it working fine. The trap snippet looks like this :
> 
>    "OurGNEFilter"
>    ENTERPROC
>      DIM evt.evtRecSize            ' event record
> 
>      a1& = REGISTER&(a1)           ' get event record address
>      d0& = REGISTER&(d0)           ' and bool result of _GetNextEvent
> 
>      evt;_evtRecSize = a1&         ' a1 is event record location
> 
>      SELECT evt.evtWhat
>        CASE _keyDwnEvt
>          vKeyCode% = PEEK (a1& + _evtMessage + 2)
>          LONG IF vKeyCode%=111:'                          (111=F12)
>            theVal&=&757F:' this is the keycode for forward delete
>            POKE WORD a1&+_evtMessage + 2,theVal&
>          END IF
> 
>      END SELECT                    ' { END SELECT evt.what }
>    EXITPROC
> 
> Basically I watch for one of those seldom used function keys, in this
> case F12 and when I detect it, I modify the event record so that it
> "thinks" it was a Forward Delete key instead.
> 
> Why Forward Delete? Because my Powerbook G3 doesn't have a forward
> delete key and I need one. I did try using KeyQuencer but for one
> lousy key it seemed like a lot of overkill.
> 
> Anyways, this works. Except. Ah yes, the catch. If you HOLD the key
> down, it doesn't generate any _keyDwnEvt events that I can detect.
> Where it goes? I don't know. It doesn't crash anything the only way
> for my routine to work is to continually stab the key. My pinkie gets
> sore...
> 
> Hints, pointers and nudges appreciated.
> 
> Mel Patrick
> mel@...
> 
> --
> To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>