Question on message handling
Jim Hurley
jhurley at infostations.com
Thu Oct 13 10:12:32 EDT 2005
>
>Message: 17
>Date: Wed, 12 Oct 2005 17:26:20 -0500
>From: Ken Ray <kray at sonsothunder.com>
>Subject: Re: Question on message handling
>To: Use Revolution List <use-revolution at lists.runrev.com>
>Message-ID: <BF72F7BC.2D8F8%kray at sonsothunder.com>
>Content-Type: text/plain; charset="US-ASCII"
>
>On 10/12/05 2:22 PM, "Jim Hurley" <jhurley at infostations.com> wrote:
>
>> What puzzles me is that the card apparently gets the keyDown message
>> before the field does. That is exactly what I am looking for, but I
>> don't quite see why. If I'm typing in a field, why doesn't the
>> field get the message before the card? Is that the priority that is
>> set when the text is not locked, i.e. card first, field last?
>
>No... in fact I created a simple test stack with a field with this script:
>
>on keyDown
> put "Field" after msg
> pass keydown
>end keyDown
>
>and a card script that said:
>
>on keyDown
> put "Card" after msg
> pass keydown
>end keyDown
>
>And when I clicked in the field, the message box read:
>
> FieldCard
>
>So the field is definitely getting the message first (which is what I would
>expect).
>
Ken Ray
Jacque and Ken,
Yes, I see. I'm afraid I expressed myself badly--and incorrectly.
I am working on a transcription stack, i.e. a stack which will speak
an audio file while the user types what he or she hears into a field.
There is no field script. The card script is:
on keyDown theKey
switch theKey
case "/"
send "mouseUP" to button "pause"
break
case "\"
send "mouseUP" to button "resume"
break
default
pass keyDown
end switch
end keyDown
When the user types a "/" the speech pauses. When the user types "\"
the speech resumes--actually it backs up a little bit and then
resumes. The keyboard replaces the usual foot pedal in transcription
hardware.
What I found surprising (and welcome) is that the back and forward
slashes never appear in the field. The key stroke is never passed
back to the field for display after it is caught by the card script.
(It would be if there were a "pass keyDown" in the first two case
statements.) So apparently the field gets the message first, then
then card (as you both say) and then, if the key stroke is passed by
the card script, it is passed back to the field display for viewing.
I was wrong to speak of this last message as part of the conventional
message passing path. Maybe "display" message? The keyDown message is
never *displayed* unless it is passed through all of RR message
handlers--display is the last in line. And as Martha Stewart would
say: It is a good thing.
Thanks,
Jim
More information about the use-livecode
mailing list