Close Substack Question?

David Burgun dburgun at dsl.pipex.com
Thu Apr 6 08:23:46 EDT 2006


Hi,

On 5 Apr 2006, at 18:19, J. Landman Gay wrote:
> What you describe is the default behavior and you shouldn't have to  
> do anything to accomplish it. The IDE will ask if you want to save  
> if the stack is dirty. If you have no handlers that interfere with  
> closeStackRequest, closeStack, etc. then your stack should act the  
> way you want it to. There is no documentation about it because you  
> have to actively write handlers to prevent it if you don't want  
> that behavior.
>
> In a standalone, you would have to write the handlers that track a  
> dirty variable and ask to save, since this is part of the IDE but  
> doesn't exist in a standalone. For that, a closeStackRequest is the  
> most commonly-used way to trap a click on the close box. When you  
> are done checking the dirty status and saving the stack, pass the  
> closeStackRequest to allow the stack to close.

I am more confused than ever now! The whole thing is more confused  
since I have most of the "open" and "close" handlers in Card 1 of the  
stack(s). I still don't fully understand why I need them in Card 1,  
but when I was having problems with it in the past someone told me to  
put them in card 1 so I did. I really would like to get this under  
control and have all the handlers I need in the right places and just  
have it work!

So in my setup, I have this:

LibStackA:mainStack - no preOpenStack, openStack, closeStack, no  
closeStackRequest.
One card in the mainStack, no Substacks.

LibStackB:mainStack,no  preOpenStack , no openStack, no closeStack,  
no closeStackRequest
One card in the mainStack, one Substack.
LibStackB:subStack1:Stack Script, preOpenStack , openStack,  
closeStack, closeStackRequest, no "pass" in any handler.
One Card
------
NormalStackA:mainStack:Stack Script, no preOpenStack ,no openStack,  
no closeStack, no closeStackRequest
NormalStackA:mainStack:Card1 Script,  preOpenStack , openStack,  
closeStack, closeStackRequest, no "pass" in any handler.
no Substacks.

NormalStackB:mainStack:Stack Script, no openStack, no closeStack, no  
closeStackRequest
NormalStackB:mainStack:Card1 Script, preOpenStack , openStack,  
closeStack, closeStackRequest, no "pass" in any handler.
no Substacks.

What should the action be for this Setup? With it set like this, if I  
click close on the LibStackB:subStack1 window, I get the "Do you want  
to save?" dialog.

  I have the feeling that when I added a pass to "closeStackRequest"  
in my normal stack(s), it fell thru into the library stack.

Do I need to test if the close was for the this stack? If so how do I  
do this? Would the following work:

if the name of this stack <> myStackName then pass  
"closeStackRequest"  ???

Sorry to be a pain, it's just something that I can't seem to get my  
head around! Once I get this straight I'm sure it will stick and I  
won't have to worry about it ever again!

All the Best
Dave





More information about the use-livecode mailing list