when sent a message, the target can't find itself!

J. Landman Gay jacque at hyperactivesw.com
Sat Aug 4 22:19:32 EDT 2012


On 8/4/12 5:37 PM, Dr. Hawkins wrote:

> The catch is that the handler has no advance knowledge of what field
> or card it can be called from--I'm trying to make something generic
> that can add a currency formatted value to a field that already
> contains a currency formatted value.

It doesn't matter. The "long name" of anything always contains an object 
reference. In the case of a field, it will always contain the word 
"field". The long name of a button will always contain the word "button".


> My real need is the very narrow issue of a handler pulling the value
> of the field that called it, and then putting something back in.  It
> seems that this should take one line of code, not 8 or 10.

Try it this way:

   get the value of the target
   add 45 to it
   put it into the target

Or in one line:

   put 45 + the value of the target into the target

Or even shorter (omission of "the" is intentional):

   put 45 + target into the target

The "target" changes frequently. I've lost track of exactly what your 
scripts do, but generally it's safer to store the target in a variable 
immediately and work with that, rather than depend on it remaining the 
same for any length of time. Some of the failures you're seeing may be 
because the target has changed unexpectedly.

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




More information about the use-livecode mailing list