And while I'm at it...

Kay C Lan lan.kc.macmail at gmail.com
Sun May 22 13:45:56 CEST 2016


In your Mainstack, as part of it's stack script, can't you have,
within a closeStack handler that already exists or just add one:

if then number of lines of openstacks() = 2 then show stack "Mainstack"

2 assumes that you aren't using any other stacks as toolbars or some
such and this is in a standalone - in the IDE the number will be much
higher depending on what you have open, but easy enough to determine.
So assuming you have a standalone with a Mainstack and two Substacks,
when you close a Substack openstacks() will report 3 as the substack
isn't actually closed until the closeStack handler completes. When you
close the last remaining substack, openstacks() will report 2, the
Mainstack will be shown and then the Substack will be closed - but
it's so quick it appears to be instantaneous.

This is pretty basic. If you are using toolbars, plugins or other
things so it's not that simple to test the number of openstacks,
openstacks() actually gives you the names so a more complex test could
be carried out based on the existence or lack thereof of names in the
list. As long as your test is carried out in the closestack handler of
the stack script of the mainstack, every time a stack is closed you
will be able to test if it's appropriate to show your Mainstack.

HTH



More information about the use-livecode mailing list