Target and me. Target not the correct value

Richard Gaskin ambassador at
Sun Aug 8 22:35:25 EDT 2004

Matt Denton wrote:
> Hey ho.
> Just found a small discrepancy: the 'me' function will always return the 
> correct object, however 'the target' will only return the name of the 
> object.  This becomes an issue if you, like me, sometimes duplicate an 
> object and forget to give it a unique name.  Create a button, put this 
> script in it:
> on closeField
>   put the value of me
> end closeField
> Now duplicate (or option-drag) a copy.  Change text in the field, notice 
> the correct values are reported back to the msg window. Now change BOTH 
> scripts to:
> on closeField
>   put the value of the target
> end closeField
> ... this reports incorrectly, only reporting 1 field (the first found 
> with the name 'Field 1').  I kinda remember in my dim past that 
> HyperCard would always return the target value correctly, even with 
> object name duplication?
> Confusingly, just 'target' (no 'the') returns the value correctly; 'the 
> value of the target' doesn't when there is a duplicate name.  Small, 
> simple, but had me stumped for a bit.  As you might expect, 'put the 
> value of (long ID of the target)' works.  Of course avoiding duplication 
> is good practice; not trusting 'the target' is safest if you can't 
> guarantee unique field/group/button etc names.
> I'd like to see 'the target' use the long ID for object referencing, but 
> use the name of the target (as it does now) when used for display.  Is 
> that possible?  Anyone agree?

I agree, but I think what we're seeing here is something.

What happens if you change the name of the fields?

The phrase "field 1" is itself a valid object descriptor, so apply the 
value function to that may be what's tripping you up.

  Richard Gaskin
  Fourth World Media Corporation
  Ambassador at

More information about the Use-livecode mailing list