Auto completion of a text field

Peter Haworth pete at lcsql.com
Sat Apr 6 15:20:24 EDT 2013


Trying to implement an auto completion function for a text field.

I have a keyUp handler that gets the current contents of the field and
searches though a list of possible matches.  If one is found, I tried
setting the text of the field to it. I see the match turn up in the field,
but when I leave the field, an exitField message is sent rather than a
closeField message, indicating that the field contents didn't change, which
they clearly did.

Next I tried using the type command to put the extra characters of the
matched string into the field. That works but looks kinda
clunky especially if it's a lengthy string, even though I set the typing
rate to zero before issuing the type command, .

Setting the text of the field is very smooth but the lack of a closeField
message makes it impractical for me.  Seems like setting a field's contents
should make it aware that its contents have changed but apparently not.
 Any tricks to achieve this?

Thanks,


Pete
lcSQL Software <http://www.lcsql.com>



More information about the use-livecode mailing list