Page 1 of 1

Check if substack is already loaded

Posted: Thu Apr 16, 2015 3:14 am
by bergsy
Hi,

I want to be able to check to see if a substack has already been loaded on screen so I don't reinitialise the objects. I want code something like that below from my main stack:

-- need code here to figure out if stkStack2 is already showing to the user
if bVisible then
go stack stkStack2
else
put "test" into fld fldTest of stack stkStack2
go stack stkStack2
end if

I have tried looking at the visible property of the stack stkStack2, but that is always true, whether it has been loaded on the screen or not

Any suggestions appreciated

Cheers

bergsy

Re: Check if substack is already loaded

Posted: Thu Apr 16, 2015 4:02 am
by Simon
Hi bergsy,
Check out "openStacks" in the dictionary.

Simon

Re: Check if substack is already loaded

Posted: Thu Apr 16, 2015 5:36 am
by FourthWorld
You could also set a flag in a global, something like gInited - check it during init and if empty run your setup and then set it to true.

Re: Check if substack is already loaded

Posted: Thu Apr 16, 2015 8:14 am
by bergsy
Hi Simon,

Works great - I just check for the stack name in all the open stacks

Cheers

Bergsy

Re: Check if substack is already loaded

Posted: Thu Apr 16, 2015 12:47 pm
by Klaus
Hi Bergsy,

little background info:
When you open a stack (file from disk), then this stack and ALL its substacks, if any, are loaded into RAM.
So your substack has in fact already been loaded and you wanted to check if is is OPEN already.


Best

Klaus