Checks if the key has beed pressed during the time period between two events (mouse clicks). Very useful if you need to have statistics of keyboard usage.
-- Generic behavior to detect if the key has been pressed
-- KeyboardControl Xtra 1.1 or later required
property Key
on getPropertyDescriptionList
set description = [:]
addProp description, #Key, [#default: "", #format:#string, #comment:"Key to check for keystroke:"]
return description
end
on getBehaviorDescription
return "Checks if the key has beed pressed during the time period between mouse clicks"
end
on mouseDown
detectKey
end
on detectKey
set Ok = KeyboardControlKeyBeenPressed(Key)
if getAt(Ok,1) = 0 then
case getAt(Ok,3) of
0: set WasPressed = False
1: set WasPressed = True
end case
if WasPressed = True then
alert ("The " & Key & " key WAS PRESSED since the last click")
else
alert ("The " & Key & " key WAS NOT PRESSED since the last click")
end if
else
-- An error has occured, show error code
alert("Error: " & getAt(Ok,1) & " - base error code")
end if
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA