Page 1 of 1
Test for If Sub-Stack is Open
Posted: Mon Jun 25, 2012 10:18 pm
by townsend
It's convenient that you can manipulate the objects of sub-stacks even when they are closed.
So I've got a Timer which keeps on firing, even after the Sub-Stack is closed.
Is there some way to test whether or not a stack is open or closed?
If not-- I could just use a global variable. Just curious.
Re: Test for If Sub-Stack is Open
Posted: Mon Jun 25, 2012 10:44 pm
by dunbarx
Hi.
I played around just a little, probably you did too.
The "stacks" only returns open stacks, and the "substacks" is more a property of a mainstack. But if your stack is not in "the stacks", it is not open. You could check this.
But I think you want to know if a stack (one with its "destroyStack" set to "false") is still in memory, even though closed, right?
No clue. But I bet there is a native property that does this. LC has everything else.
Craig
Re: Test for If Sub-Stack is Open
Posted: Tue Jun 26, 2012 1:04 am
by sturgis
I think what you're looking for is revloadedstacks
edited: Will show stacks, loaded into memory or visible and open.
Re: Test for If Sub-Stack is Open
Posted: Tue Jun 26, 2012 3:47 pm
by townsend
Thanks for your feedback on this.
I used:
Code: Select all
set the destroyStack of stack "mySubStack" to true
close stack "mySubStack"
Then, it turns out, the
revloadedstacks() function shows:
All stacks part of the main stack. In memory or not. Open or not.
Re: Test for If Sub-Stack is Open
Posted: Tue Jun 26, 2012 3:55 pm
by Klaus
Hi guys,
hint: I think "revlodadedstacks()" and other "revXXX" commands/functions are only available in the IDE and not in runtimes!
Best
Klaus
Re: Test for If Sub-Stack is Open
Posted: Tue Jun 26, 2012 4:33 pm
by sturgis
Note: When included in a standalone application, the Common library is implemented as a hidden group and made available when the group receives its first openBackground message. During the first part of the application's startup process, before this message is sent, the revLoadedStacks function is not yet available. This may affect attempts to use this function in startup, preOpenStack, openStack, or preOpenCard handlers in the main stack. Once the application has finished starting up, the library is available and the revLoadedStacks function can be used in any handler.
Don't see anything contra-indicating use of this in a standalone, and the above paragraph seems to indicate it will work fine, but since I haven't tested it in a standalone your mileage may vary. Documentation and reality don't always mesh!
Re: Test for If Sub-Stack is Open
Posted: Tue Jun 26, 2012 4:41 pm
by Klaus
Hi all,
oops, sorry, looks like I am not up-to-date
Best
Klaus
Re: Test for If Sub-Stack is Open
Posted: Tue Jun 26, 2012 4:46 pm
by sturgis
If your stack app has the mainstack and all other stacks you use saved as substacks of the mainstack, then yes. You open the mainstack, viola' the main and substacks are shown in the app browser. (meaning the substacks are in memory) If you right click the substack in the app browser one of the options is to close it and remove it from memory.
If you have a main stack and load external stacks using code the stacks won't show up in the app browser and are not in memory (assuming they haven't been previously loaded) at which point it only shows "in memory" stacks.
As mentioned the destroystack property can change whether recently closed stacks are in memory or not.
At least I think this is how all this meshes together.
townsend wrote:Thanks for your feedback on this.
I used:
Code: Select all
set the destroyStack of stack "mySubStack" to true
close stack "mySubStack"
Then, it turns out, the
revloadedstacks() function shows:
All stacks part of the main stack. In memory or not. Open or not.