the object you are editing... Huh?

J. Landman Gay jacque at hyperactivesw.com
Tue Jun 21 17:58:05 EDT 2005


On 6/21/05 3:02 PM, Timothy Miller wrote:


> That should have been
> 
> on closeField
>   put target into target
>   pass closeField
> end closeField
> 
> This handler remains a prime suspect, because I haven't seen the problem 
> since I commented it out. Does the corrected version of the handler look 
> more problematic?
> 

This handler doesn't do anything. There is a difference between "the 
target" and "target", both of which are recognized tokens in the 
language. "The target" refers to an object reference; i.e., if you click 
a button then "the target" is a reference to the button. "Target" 
(without "the") is only applicable to fields, and refers to the text of 
the field. The looseness of the language allows scripters to omit "the" 
in many built-in functions (though I recommend against it) but this is 
one case where it makes a difference.

In your handler above, "put target into target", the first "target" will 
be resolved to mean "the target" because of the engine's flexibility. 
But the second "target" will be nonsense; possibly interpreted as a 
variable name, or possibly causing problems.

It is strongly recommended that all functions include "the" in scripts, 
just for this reason. Always use "the date", "the time", "the target", 
even though plain old "date", "time", and "target" may sometimes work.

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


More information about the use-livecode mailing list