> well in my searching there is a commandDown (if command key is held),
> shiftDown, controlDown and optionDown(all pretty self-explanitory). I
> guess
> if you piped them thru a keyDown or keyUp function you could check to
> see if
> they are release or not
>
That's exactly what I do. My key handler is something like this:
on keyDown me
pCntlDown = the controlDown
pCmdDown = the commandDown
pOptDown = the optionDown
pKey = chartonum(the key)
keyID = defineKey(me)
doKey(keyID) -- custom handler to do whatever you want
end
on defineKey me
-- We look at the keystroke differently if it's a Windows function or
special key
-- First check to see if it's a special key
pKeyCode = the keyCode
if pKeyCode > 96 then --F5, the lowest value for a function key
pKeyCode = pKeyCode + 256
if kMachine = "Macintosh" then
set keyID = adjustMacKeys(me, pKeyCode)
else
set keyID = adjustWinKeys(me, pKeyCode)
end if
return pKeyCode
else
-- it's not a special key, so use the key instead of the keycode
if kMachine = "Macintosh" then
keyID = adjustMacKeys(me, pKey)
else
keyID = adjustWinKeys(me, pKey)
end if
return keyID
end if
end
on adjustMacKeys me, keyID
if pCntlDown or the controlDown then -- funky catch-all for Macs.
hmph.
set keyID = keyID + 256
else if pCmdDown or the commandDown then -- commandDown.
case keyID of
113
if pQuitOK and (offset("credits", the movieName) = 0) then
AskQuit -- quit, command-q.
end case
end if
return keyID
end
-- we have to handle option & control keys differently on Windows.
-- we just convert to the Mac equivalents before calling #doKey.
on adjustWinKeys me, keyID
if pCntlDown or the controlDown then -- what the hell. Win may not
get controlDown here, either.
case keyID of
29, 31, 28 -- right, down, and left arrows.
set keyID = keyID + 256
113
if pQuitOK and (offset("credits", the movieName) = 0) then
AskQuit -- Ctrl-Q
otherwise
set keyID = keyID + 160
end case
else if pOptDown or the optionDown then -- optionDown.
case keyID of
pF4 -- defined as 374 (decimal)
if pQuitOK and (offset("credits", the movieName) = 0) then
AskQuit -- quit, alt-F4.
end case
end if
return keyID
end
Cordially,
Kerry Thompson
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]