the focusedObject

Richard Gaskin ambassador at fourthworld.com
Sun Jan 11 20:58:34 EST 2009


Paul Looney wrote:

> "Target" is contents of the field.
> "The Target" is the name of the field in the following format: field  
> "xyz"

And they say HyperCard was easier to learn? :)

What lexical logic drove such a decision?  I would have loved to have 
been a fly in the room during that meeting; it might help explain HC's 
scrolling mechanism. ;)

> The problem with your script could be that you have quoted the name  
> of the field but not the word "field" in front of it.
> You might try something like:
> if the target = ("field "&&quote&"f_i_billoflading_specialNote"&quote)

These HyperCard-based ambiguities are among the hardest xTalk things to 
teach, so chock full o' gotchas and sometimes rules that it's hard to 
keep them straight.

While your suggestion does a good job of coercing the right-hand 
expression to be evaluated as an object descriptor to match the 
left-hand one, I tend to avoid these ambiguities altogether and use 
property syntax instead:

   if the long id of the target = the long id of fld "Whatever"

- or -

   if the text of the target = the text of fld "Whatever"

This way anyone can read this code, and even without a decade of knowing 
the mysteries of HyperCard's gotchas they can still instantly grasp 
what's being compared, whether it's an object reference or the contents 
of the object.

I love xTalk, but some of the decisions from the HC team continue to 
mystify me, and continue to cost new learners time long after its demise....

--
  Richard Gaskin
  Fourth World
  Revolution training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com



More information about the use-livecode mailing list