SelectedChunk
Ken Ray
kray at sonsothunder.com
Mon Mar 21 01:08:29 EST 2005
On 3/20/05 10:38 PM, "Mikey" <mikeythek at gmail.com> wrote:
> Hmm. Per previous discussion, in an attempt to determine where the
> cursor was when the user hit a key (in this case a tab key), I
> generated the following script for the field in question
>
> on tabKey
> get the selectedChunk
> answer it
> end tabKey
>
> the variable watcher reports that IT is empty. In addition, changing
> the code to
>
> on tabKey
> put the selectedText into foo
> answer foo
> end tabKey
>
> the variable watcher reports the same thing for foo. As one would
> expect, in either case the answer is empty.
As it turns out, Mikey, you picked one of the few keys that would actually
do something about changing the focus, etc. when the key is struck. Look at
"tabKey" as the equivalent of "keyUp", meaning that it takes place *after*
the key has been struck, so it actually tabs out of the field (or at least
clears the selectedChunk) before you trap it. What you want to use is
"rawKeyDown" instead:
on rawKeyDown pKey
if pKey is 65289 then -- key code for Tab
get the selectedChunk
answer it
end if
pass rawKeyDown
end rawKeyDown
HTH,
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list