Capturing text as user types (was Re: setting the default folder...)
inperson at pnc.com.au
Mon Dec 17 18:21:03 EST 2001
> From: John <johng at cablespeed.com>
> Hope someone can help. I have an application that needs to look the
> text the user is typing and editing in real time. For each keystroke I
> need to work out what the current word is. This is complicated a bit by
> the fact that the user is free to edit text anywhere in the field -
> simply capturing keystrokes and building the word as they type will not
> work because they could have begun editing a word in previously typed
> text. The following example solves the problem but is very, very slow
> (to the point of making it unusable).
I used this technique in SC once and it was quite fast (it is surprising how
much you can get done between keystrokes) - it let me capture and do
processing on a field "live" behind the scenes. In rev you could use the
send command if you don't like using idle.
put field myField into field "debug"
This might not be quite what you are after, but could help...you could
compare captured strings at each tick or whatever period you want to find
what has changed...
Another approach might be to check for spacebar presses, so you could get
the last word entered during 'normal' typing, and go after mouseClicks and
other signs of editing as special cases only as they occur.
More information about the Use-livecode