type ahead search and typing speed
Devin Asay
devin_asay at byu.edu
Thu Jun 28 20:02:08 EDT 2007
Hi all,
I have looked at this one until I'm cross-eyed, and I can't figure
out the problem.
I am working on a program in which there are a couple of fields that
need to be filled in with user names. I keep a list of users in a
separate field. With some help from some of you here, I have
implemented a "type-ahead", auto-completion search that searches the
list of names with each keystroke, and auto-completes the entry field
if it finds that the string I have typed matches the beginning of one
of the names in the list. The rest of the matched name, the part I
haven't typed yet is added to the field, but remains selected. If I
hit return or tab, the matched name is left in the field. It's a
common feature, you see it in web browser URL fields, for example.
It all works fairly well, except for one big problem. If the user
types very rapidly, after 2 or 3 characters typed, and a name is
matched, the insertion point jumps to the end of the field, *after*
the selected auto-completed text, then characters are entered at the
end of the field, instead of staying at the original insertion point.
I'm afraid I'm not explaining it very well, but if anyone has a
couple of minutes and a pair of fresh eyeballs, would you mind
looking at:
go stack URL "http://asay.byu.edu/typeAheadSearch.rev"
Just start typing, say, my name, starting with the last name. You'll
see the list pop up and it will start to match "A" names. As long as
you type slowly you're fine. But as soon as you start typing fast--
try "anderson", for example--you'll see the problem I'm running into.
This example stack leaves out some of the details of key handling,
but demonstrates the problem.
I would appreciate any suggestions, and I'll be happy to share the
completed code with anyone who's interested.
Regards,
Devin
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list