Can Standalones Do "do"?

Richard Gaskin ambassador at fourthworld.com
Mon Sep 22 16:48:01 EDT 2003


Rob Cozens wrote:

> SDB Data Dictionary includes a field where the developer can type a
> validation handler to applied to the field contents when the field is
> closed.  The idea was something like this:
> 
> on closeField
> global passedData
> put me into passedData
> do (field "Validation")
> if the result is not empty then -- take error return
> [snip]
> end closeFields
> 
> Cool and powerful stuff; but if a standalone can't do "do", I'm
> wasting my time.
> 
> Am I wasting my time?  Is there another way to change handlers on-the-fly?

"do" is supported in standalones within the bounds of the scriptLimits,
currently 10 or fewer lines of executable code.

But another approach may have merit:  you could have two handlers, one in a
frontScript and another in a backScript or library that handle everything
for you based on a property setting in the target object.

The closeField message would be handled in a frontScript, which could check
a property in the field which determines which validation code to run.  Then
it just calls the appropriate validation handler residing the the
backscript/library to handle it.

While it takes just a little more effort to set up it keeps all of your
validation code in one place and reduces the coding needed to validate
anything anywhere in the system.

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc




More information about the use-livecode mailing list