Page 1 of 1
Un-opened Sub-Stack
Posted: Sun Feb 02, 2014 1:27 am
by lohill
Is it true that objects on cards of not yet opened sub-stacks are not accessible until that sub-stack has first been opened? Once that sub-stack has been opened it can then be closed and the objects will remain accessible. Specifically I want to have some datagrids on a substack and yet be able to access data from them at all times. How is the best way to handle that access without the user being aware.
Thanks,
Larry
Re: Un-opened Sub-Stack
Posted: Sun Feb 02, 2014 6:10 am
by dunbarx
Hi.
The substack is available from the mainstack even if it has not been navigated to. Make a new stack named "xxxx". Put a button in it. Make a substack named "zzzz". Put a field in it with some data. Go back to the main stack and put this in the button script:
Code: Select all
on mouseUp
answer fld 1 of stack "zzzz"
end mouseUp
Save the stacks. Quit LC. Open the mainstack again and click the button.
Craig Newman
Re: Un-opened Sub-Stack
Posted: Sun Feb 02, 2014 1:54 pm
by Klaus
Hi Larry,
for completeness, you can even access stack files that are not open at all currently!
...
put specialfolderpath("documents") & "/a_stack.rev" into tStackFile
put the text of fld 1 of cd 2 of stack tStackFile into tText
...
tStackFile will point the engine to the MAINSTACK of that stack file, but can also access its substacks:
...
put the text of fld 1 of cd 2 of stack "a substack" of stack tStackFile into tText
...
Best
Klaus
Re: Un-opened Sub-Stack
Posted: Mon Feb 03, 2014 6:08 pm
by lohill
Thanks Craig and Klaus,
Wow. That is amazing.
Larry
Re: Un-opened Sub-Stack
Posted: Wed Feb 05, 2014 8:16 pm
by lohill
Craig,
What you said might be true in the simple case you give of one main stack and 1 substack but it absolutely does not work in my case with one main stack and about 20 substacks. If I quit the IDE and then come back in and open the main stack my routines for finding the the data which are contained on a card of the substack do not work until I first open the card in the substack. I can then close the card and everything works OK from that point. It may be that it is because the data I want are in dataGrids. My 'dispatch "FindIndex" to group "DataGrid 1" of card 1 of stack "Translations"' fails to bring back the index. My LineCode is the latest stable version - 6.5.2.
Now I need to ask what is the best way to open and close a card on a substack without the user being aware of it? I assume it would be at the open of my program.
Thanks
Re: Un-opened Sub-Stack
Posted: Wed Feb 05, 2014 9:50 pm
by dunbarx
Hmmm.
So I made a stack with a half dozen substacks. Put a field with some data on all substacks. Put a button on the mainstack asking for the data on those substacks. Saved. Quit LC. Reopened the mainstack from the finder. Clicked on the button. No problem.
I cannot believe, though have not tested, that the number of substacks (my 6 vs. your 20) matters. Can you do what I did?
Craig
EDIT. My fields are on card 1 of my substacks. This is the default target card when referencing the stack, since there is only one. Is it possible that you are trying to retrieve data from other cards than the first on your substacks? Because that would do it.
MORE EDIT. I see you explicitly reference the card. I will check a datagrid retrieval. Also, you can always lock the screen on preOpenWhatever, navigate to the substacks, and return.
Re: Un-opened Sub-Stack
Posted: Wed Feb 05, 2014 10:09 pm
by dunbarx
OK.
Tried it with a DG on one of the substacks. No problem:
Code: Select all
on mouseUp
answer the dgtext of group 1 of stack "u7"
end mouseUp
Craig
Re: Un-opened Sub-Stack
Posted: Wed Feb 05, 2014 10:31 pm
by dunbarx
Also it makes no difference if the DG is on another card than the first one. Again, from the finder:
Code: Select all
on mouseUp
answer the dgtext of group 1 of cd 2 of stack "u7"
end mouseUp
Comes back fine.
Craig