Okay I think I see now why my closeStack handler never got triggered in the 
mainStack. The closeStack handler is in the card script! The current card of 
the mainstack is not in the message path. Interesting little quirk, but I see 
the advantages. The card script will only see closeStack messages for the stack 
it's in. The stack script will see ALL of them, including substack closeStack 
messages (if passed). 

<sigh> My brain is not big enough to wrap itself around all the little 
idiosynchracies of LC. Not complaining, just saying. 

Bob S


> On May 22, 2016, at 04:45 , Kay C Lan <lan.kc.macm...@gmail.com> wrote:
> 
> 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
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to