Auto completion of a text field

J. Landman Gay jacque at hyperactivesw.com
Sat Apr 6 16:03:22 EDT 2013


On 4/6/13 2:20 PM, Peter Haworth wrote:
> 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?

Send "closefield" yourself at the end of the insertion handler. Though 
I'm not sure you need that message; if there is some action a closefield 
handler does, separate it out and then call that handler instead.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list