scriptsLimits

Rob Cozens rcozens at pon.net
Sun Jul 18 10:44:44 EDT 2004


>I currently have a 'control' that represents a template class (each 
>is self registering).  When the developer calls createInstance a 
>clone of that control is created and 'the script' is modified to 
>accept messages in the form of <instance name>.<method> at this time 
>the script property is set and added to the backscripts.  This does 
>not seem to work in a stand-alone due to script limits any ideas on 
>alternatives to this?

Kevin,

Script the handler to derive <instance name> & <method> from a custom 
property or global variable which is set when the clone is created:

on createInstance
    global instanceAndMethod
   ...
   clone control x
   put myInstance&"."&myMethod into instanceAndMethod
end createInstance

in the backScript

   global instanceAndMethod
   get offset(".", instanceAndMethod)
   put char 1 to (it-1) of instanceAndMethod into theInstance
   put char (it+1) to -1 of instanceAndMethod into theMethod

If instanceAndMethod is specific to the control with focus, set the 
clone's instanceAndMethod property instead of using a global.

on createInstance
   ...
   clone control x
   get word 3 of it
   set the instanceAndMethod of control id it to myInstance&"."&myMethod
end createInstance

in the backScript

   get the instanceAndMethod of the target
   put char 1 to (it-1) of instanceAndMethod into theInstance
   put char (it+1) to -1 of instanceAndMethod into theMethod

These techniques require no changes to any script when the control is cloned.

-- 

Rob Cozens
CCW, Serendipity Software Company

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)


More information about the use-livecode mailing list