Home Gadgetman Forum Book Reviews Links Contact me X-UFO
Gadgets Processors Programming School Old news
The [Ctrl] key is used for shortcuts. It's supposed to use the Ctrl combinations visible in the 'pull down Menu'.
Here's how to handle it:

The Eventdata&(16) array contains the key in pos 1, and modifiers in pos 4.

The Keykode is 1 for A, 2 for B....

GLOBAL LCaseKeys$(27)   
GLOBAL UCaseKeys$(27)
   LCaseKeys$="noexcv"      REM Place in first PROC
   IF eventdata&(4) AND 2 Test for [Shift]
      IF (Eventdata&(1)+64) AND (LOC(UCaseKeys$,CHR$(Eventdata&(1)+64))<>0)
               REM Only gets here if Illegal [Shift]+Key
      IF (Eventdata&(1)+64) AND (LOC(LCaseKeys$,CHR$(Eventdata&(1)+64))<>0)
               REM Only gets here if Illegal 'Non-Shifted' Key

The mess with the LOC command is to ensure that the proc you are about to call is valid.(If it's letter is in the strings it's considered valid.) If you must disable something, just remove it from the string. The strings will also show you which keys are not already used :-) NOT using the strings WILL cause a crash when a user presses an illegal key...

As you can see we can't access ANY of the choices witch had a numeric code in the MENU. Therefore NEVER use numerics(1 - 32) for often used functions!

<<7. Handling the [Menu] key>>
<<How to build an application>>
<<9. System Events>>