Problems with closeField

Wilhelm Sanke sanke at
Sun Sep 12 07:08:08 EDT 2004

On Tue, 7 Sep 2004, JonathanC at

> I can't believe I'm having a problem with something as simple as
> "closeField"!
> I have a field which works like the Address bar of Internet Explorer. 
> When
> you start typing into it, it tries to finish the word or phrase, 
> according
> to a list in a separate field (which will eventually be hidden). If you
> end up typing a NEW word or phrase, you are asked if you would like this
> added to the list, for next time. I got it to work fine in HyperCard, but
> I'm stumped by the strange behaviour of "closeField".

Hi Jonathan,

Finally I managed to take a look at your sample stack; sorry for the delay.

After some experimenting I changed three things in the script of fld 

- 1. I changed the "closefield" handler to a "exitfield"

This is contrary to what you would expect from the docs

(closefield = the field's content has changed
exitfield = the contents of the field have not changed),

but it seems to work.

- 2. I intercepted the "Cancel" message of the modal dialog which now 
sets a variable ("ControlVar") to false - to avoid the modal dialog to 
be repeated again and again

- 3. I declared a local var in the first line of the field script and 
set "ControlVar" to true at the beginning of the "keydown" handler

This seems to solve your  immediate problems as you stated them. There 
are probably a number possibilities to refine and enhance your 
auto-complete routines.

Best regards,

Wilhelm Sanke

More information about the use-livecode mailing list