Closing a stack and deleting it too

Bob Sneidar bobsneidar at iotecdigital.com
Fri Oct 21 10:37:41 EDT 2016


I thought this was an ongoing thread that had been answered, but at the risk of repeating all of you, The trick would be to send "close this stack" in 0 seconds. I've not tried it, so I am not sure if it actually works, but that is the prescribed method.

Bob S


On Oct 21, 2016, at 01:46 , Graham Samuel <livfoss at mac.com<mailto:livfoss at mac.com>> wrote:

I seem to be getting unreliable results from ‘close stack’. I note that the dictionary says:

If the handler that closes the stack is in the script of the stack (or in the script of an object in the stack) and the stack's destroyStack <> property <> is true, the stack window <> is closed immediately, but the stack is not removed from memory until after the handler  <>completes.

I find that if I have a stack with a lot of substacks, on executing ‘close stack’, just the mainstack closes, despite the despite having ‘purge stack on close’ and ‘purge window on close’ set in the main and all the substacks.

If this command worked as I imagined, it would not be necessary, or indeed appropriate, to follow it with a ‘delete stack’ command.

I think this failure to work as expected must be to do with message still waiting to finish, as suggested by the Dictionary entry - it’s probably a ‘menuPick’ handler, which is the only bit of script actually executing in the stack-to-be-deleted - but in my case apparently it never finishes. Is there a way of purging the message queue so that the ‘close’ command always does ‘delete’ as well?

If only I understood what ‘Close and Remove from Memory’ in the IDE actually does. I’ve been trying to find out for ages.

Graham



More information about the use-livecode mailing list