Hi all.
I came across an oddity with the message path and using get the value of. I am
not sure if I can be concise in my description but I will do my best. I have a
validation system which puts properties in the fields I am validating, that
contain the information necessary to perform the validation. One of the
validations is called calculate. The property contains 2 items: the formula to
evaluate, and the target field (or global variable) I want to store the result
in.
The validate handler is in the stack script, as are all validation handlers,
but there are other functions which only make sense in the card or card
behavior scripts. Now when my formula references items on the current card like
fields (field "fldUnitPrice + field "fldQuantity") then the script gets the
value of the formula and all works wonderfully. If however, I reference a
function that is in the script of the current card, then it fails with a cannot
find handler error. Well and good. I will just use the SEND command to send
"get the value of " & theFormula to this card. Doesn't work! But if I put "get
the value of " and append the actual formula in the message box it works a
peach!! ICK!!@
My only successful workaround is to put a handler in the card behavior called
doIT which has one parameter and that is a valid LC statement. I put a command
together like so:
put "get the value of " & theFormula into theCommand
put ";return it" after theCommand
dispatch "doIt" to this card WITH theCommand
put the result into theNewValue
While this works exactly as I want it to, it seems rather clunky. I do not know
why it would work in the message box, but not work even if I send the statement
directly to the current card. The only way to get it to work is to send the
command to a handler in the card or behavior that executes it in the context of
that card. Is there something special about "get the value of" that does not
pass the functions of the statement down the message path? Remember, I can
reference card objects, but NOT handlers in the script of the card! Very odd.
Bob
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode