question about mainStack scripts

Lars Brehmer larsbrehmer at mac.com
Tue Aug 30 07:35:10 EDT 2005


I have a problem with a preOpenCard handler in the stack script of  
the main stack of a huge project, that I never had before.  I've  
totally redone a ton of things in the last 3 days, but I didn't think  
any of these changes would change  the general working of it , yet  
something keeps cropping up that I haven't seen before don't  
understand.  I have managed to fix it in almost every case but 2,  
which are kind of important.  Maybe someone has the solution for me ;-)

Here goes:

In my main stack there is a preOpenCard handler.  Now, every time one  
of my many subStacks is opened, the preOpenCard handler of the main  
stack tries to run, and since it involves objects unique to that  
stack, and the handler is trying to perform itself in the subStack,   
I get an error, something like "oject doesn't exist, "  which is  
logical. In almost every case of this occurance, I solved it by  
putting a "lock messages" in the handler in question before the  
substack is opened.  This works of course but when I just double  
click on a stack in the application browser to open it, the error of  
course still happens since messages are not locked.  I can live with  
that, as long as the stanalone functions correctly.  One problem  
though - some of the handlers in question call for a substack to be  
paletted, and just locking messages before the palette command  
doesn't prevent the error.  This one I can't live with, because these  
substacks open as palettes in front of other stacks, and I don't the  
palette stack to disappear to the back when you click on one of the  
stacks behind it.  Now, before I made the changes, the main stack had  
a preOpenCard handler, very much like the new one, and it never tried  
to run as other stacks were opened.  Since my changes weren't all  
that drastic, I guess my question is - what is it about main stack  
scripts that I don't understand?  Most of my subStacks have always  
had preOpenCard handlers in their stack scripts, and they have never  
tried to run at the wrong time.  Only the main stack script does this.
What is different about main stack scripts?  And if the lock messages  
prevent it, why doesn't that work for a paletted substack?

Help, as always, would be greatly appreciated!

Cheers,

Lars





More information about the use-livecode mailing list