Close stacks and remove from memory

Mark MacKenzie m.mackenzie at sasktel.net
Thu Mar 18 18:44:27 EST 2004


Okay, I need some help.  I thought this would be straightforward for 
me.  It is probably straight forward for many others but this is eluding me.

I have a project with one main stack and eight substacks.  One of the 
substacks is a paletted navigation tool stack which floats above the 
other windows (named "Navigator"). 

I wish to catch and handle any close stack or shutdown request which the 
main stack receives and force it to be saved and then removed from 
memory upon closing.

The destroystack property is set to true for the main stack and all the 
substacks.  I have scripted a stack script residing on the main stack as 
follows:

on shutdownRequest
  answer question "Are you sure you want to quit?" with "Yes" or "No"
  if it is "Yes"
  then
    save this stack
    if "Navigator" is among the lines of the openStacks
    then
      close stack "Navigator"
    end if
    pass shutdownRequest
  end if
  close this stack
end shutdownRequest

When this executes it leaves the main stack open even though its 
destroystack property is true.

What should I do differently?

Mark MacKenzie




More information about the use-livecode mailing list