Hard CASE: cracking the nut?

J. Landman Gay jacque at hyperactivesw.com
Thu May 27 15:10:30 EDT 2010


Marty Knapp wrote:
> What I have is a standalone that contains template stacks from which a 
> user creates their own stacks. These stacks are saved outside of the 
> standalone. I wanted to institute an updating feature, where the user's 
> stack version is compared to the template (which may have had revisions 
> from being updated) on launch and if needed to have the standalone copy 
> the scripts from the template into the user stack, rather than making 
> them create a new stack. But if any of these scripts exceed the 10 
> statement limit it will not work. So I stripped the template stack of as 
> much code as I could, which also minimizes the need for updating in the 
> first place :)
> 
> But this user stack needs access to the standalone stacks and scripts to 
> function properly, so now I've found that if the user launches the 
> standalone by double-clicking their stack, that once in a while the 
> stacks/scripts it needs are not available and I get errors when the user 
> stack loads. Not always, but probably 1 in 10 times. I've tried a number 
> of routines to check for this, but these routines need to be in the user 
> stack and I run into the 10 statement limit . . .
> 
> I hope that's understandable!

Only sort of, I'm still a little confused. But basically when I have a 
system with templates, I put almost nothing in the template except very 
generic handler calls. I put all the actual, working handlers in the 
app's script, where I can change them without updating the templates.

I'm not sure why your templates need to contain any updating code. They 
should just call a handler like "checkUpdates", which the main stack 
executes. It can then act on any stacks it needs to change (with the 
exception of long scripts, but if you use the generic approach to 
handlers, that shouldn't be a problem.)

If your users double-click a stack to launch your app, your app will 
first get all the startup, preOpenStack, openStack etc. messages, and 
then will open the user stack. The mainstack's script should 
automatically be shared as a backscript, but if that isn't always 
happening you can specifically insert it on preOpenStack. That should 
clear up any issues your user stacks may have accessing the mainstack 
script. Also make sure the handlers in the user stack pass any necessary 
system messages if your mainstack needs to operate on those.

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



More information about the use-livecode mailing list