Substacks

Mark Wieder ahsoftware at sonic.net
Sun Jun 5 18:21:04 EDT 2022


On 6/5/22 05:51, General 2018 via use-livecode wrote:
> Hi,
> 
> So using real substacks being opened by go to from mainstack and then closing from substack returning to mainstack all working well, thanks for the previous suggestions.
> 
> Just found some odd behaviour :-
> 
> The mainstack and substacks have items in PreOpenStack.
> 
> The substack has for example,
> 
> On preopenstack
> Set the foregroundcolor of fld “xyz” to red
> End preopenstack
> 
> This works on the first pass of go to substack from mainstack. But if the substack is closed and go to substack from mainstack is used again the fld “xyz” is not found.
> 
> To get round this I added the cd in the substack - fld “xyz” of cd “123” .
> 
> Two questions :-
> 1. Is this the expected behaviour ?
> 2. Why does it work on the first pass without using - of cd “123”

A little hard to diagnose from a distance but here are some thoughts:

First of all, per the docs, the preOpenStack handlers should be in the 
first card of the stacks, not in the scripts of the stacks themselves.

Then it sounds like maybe you have multiple cards in your substack and 
the currently selected card is not card "123" at the time you invoke the 
goto command the second time. If the (badly-named) destroyStack property 
of the substack is set to false (the default) then the substack will 
still be in memory and your preOpenStack handler will be triggered at 
its current card setting.

-- 
  Mark Wieder
  ahsoftware at gmail.com



More information about the use-livecode mailing list