Problems with closeField

Sarah Reichelt sarahr at genesearch.com.au
Tue Sep 7 18:25:19 EDT 2004


> Here's an explanation of the problem(s):
> The "Auto-complete" field contains a closeField handler, which checks 
> its
> contents against another field ("Auto-complete list") and offers to 
> add a
> new line, if required.
> However, the closeField handler seems to only be triggered when the 
> field
> is EMPTIED.
> Expected behaviour (i.e. closeField triggered when new text is entered 
> ...
> or the field is emptied) returns when the keydown handler is removed 
> from
> the script of field "auto-complete" (or commented out).
> Then a NEW problem occurs: If you enter a word/phrase that doesn't 
> appear
> in the "Auto-complete list" field and then click out of the field, an
> answer dialog appears:
>     Add <new text> to auto-complete list?
> If you click "Cancel", the focus returns to the "Auto-complete" field.
> Then, if you click out of the field again, the whole thing starts 
> again!
> And so on, until you click "OK".
> This is weird: Why does closeField not get triggered when (I think) it
> should, but then get triggered when (I think) it shouldn't?
> Passing or not passing "closeField" makes no difference.

It sounds like the field doesn't think it has changed unless you pass 
the key messages. Perhaps you could trap openField and record the 
original contents of the field, then on exitField or focusOut, check if 
it has changed and offer to save that way.

Cheers,
Sarah



More information about the use-livecode mailing list