controlkeydown

Rob Cozens rcozens at pon.net
Wed Feb 20 14:37:01 EST 2002


>>I try to use the following handler to create a shortcut with the "T" :
>>
>>on controlkeydown "T"
>>  DoSomeThing
>>end controlkeydown
>>
>>There is no reaction. What is wrong in my handler?

Moi:>
>Salut Pierre!
>
>Try this:
>
>	on controlKeyDown zaKey
>		if zaKey is "T" then doSomething else pass controlKeyDown
>	end controlKeyDown

Pierre, et al:

While my example will work for the specific key, "T", the preferred form
for generalized control would probably be some variation on a switch.   I
have yet to use this structure, so forgive me (and let me know) if my
syntax is not correct:

	on controKeyDown zaKey
		switch zaKey
			case "T"
				doSomething
			case "U"
				deSomethingElse
				pass controlKeyDown
			case "V"
				beep  -- block ctrl-V with audio warning
			case "W"
				doYetSomethingElse
			default
				pass controlKeyDown
		end switch
	end controlKeyDown

Note: The second line in case U assumes a handler higher in the message
hierarchy must also act on the same keystroke

Rob Cozens
CCW, Serendipity Software Company

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)



More information about the use-livecode mailing list