Field Keyboard Functions
FMoyer at aol.com
FMoyer at aol.com
Thu Dec 5 15:25:01 EST 2002
Oops. I actually did have the "Switch" and "Default" and "End Switch" lines
in there -- but forgot to type them into my email letter. To be more
complete, what I have is:
on controlkeydown what
if what is in "JKL:;i" and the selectedchunk is not empty then
put the selectedchunk into sc
put the selectedloc into sl
put the shiftkey into s
put the optionkey into o
put last word of sc into fieldNumber
put fld fieldnumber into holder
switch what
case "j"
if s is down then
if o is down then
--stuff
else
--stuff
end if
else
if o is down then
--stuff
else
--stuff
end if
end if
break
case "k"
--stuff
.
.
.
default
pass controlkeydown
end switch
break
else
pass controlkeydown
end if
end controlkeydown
In a message dated 12/5/02 3:02:37 PM, jacque at hyperactivesw.com writes:
>On 12/5/02 1:39 PM, FMoyer at aol.com wrote:
>
>> My script is:
>>
>> on controlkeydown what
>> put the shiftkey into s
>> put the optionkey into o
>> if what is in "HJKLI:;" then
>> case "J"
>> if s is down then
>> if o is down then
>> -- script to select text back a word
>> else
>> -- script to move cursor back a word
>> end if
>> else
>> if o is down then
>> -- script to select text back a character
>> else
>> -- script to move cursor back a character
>> end if
>> end if
>> break
>> case "K"
>> etc.
>>
>> Any ideas what might be going wrong?
>
>You are mixing up control structures. The "case" statement has to be
>part of a "switch" structure. It should be like this:
>
>if what is in "HJKLI:;" then
> switch what -- need this
> case "J"
> -- stuff
> break
> case "K"
> -- stuff
> break
> end switch -- need this too
>end if
>
>Actually, you don't even need the "if" part; the switch structure itself
>
>will test for the contents of "what". So you could just do it this way:
>
>on controlkeydown what
> switch what
> case "J"
> -- stuff
> break
> case "K"
> -- stuff
> break
> default -- this should probably be in there too
> pass controlkeydown
> end switch
>end controlkeydown
>
More information about the metacard
mailing list