Mainstacks and substacks?

Klaus Major klaus at major-k.de
Sun Aug 1 18:23:53 EDT 2004


Hi Kee,

> First, my questions are no where near as important as Pamela's, but 
> perhaps they are easier to answer?
>
> Question #1: removing a substack from a mainstack
>
> I have a mainstack StackB and so that I could use XML when I compile 
> it, I somehow managed to add revSOAP.rev into it. I am able to compile 
> StackB and distribute it as a standalone to folks.
>
>      [StackB(revSOAP)]
>
> Now, as I believe I have learned, you cannot have a mainstack (StackB) 
> save changes to itself. If you want to do that, you need to create a 
> splash screen stack as the mainstack (StackA), and then put the old 
> mainstack (StackB) where data wants to be saved, as a substack of that 
> splash screen stack (StackB).
>
> Assuming this is correct, it is also my understanding that substacks 
> (StackB) cannot have substacks (revSOAP). So how do I remove revSOAP 
> from StackB so that I can import it as a separate substack in StackA 
> along with StackB?
>
> What I have:
>      [StackA(StackB(revSOAP))]
> What I think I want:
>      [StackA(StackB,revSOAP)]

This is a one-liner in the message box:

set the mainstack of stack "revSOAP" of stack "StackB" to "StackA"  
##Enter :-)

> Question #2: docs for apps with data saved in substacks
>
> Where are the docs for understanding how to build a standalone that 
> can retain data in substacks?

There is none that i know...?

But see my quick lesson below ;-)

> I've looked at the example on the runrev site, I've looked through the 
> 1.1.1 manuals, I've searched
> the online docs and I've looked at Dan Shafer's Volume 1. I know this 
> is supposed to be simple but
> I cannot find the answer.

Since the user of your app MAY not have write access to the application 
folder!,
i do this all the time with BIG success :-)

Create your stack that you want to be saved later on the users hd...
Then put it into a customproperty of your 
main-/splash-screen/standalone stack:
...
set the stack2save of this stack to url"binfile:my_sub.rev"
...

Then "on preopenstack" check these folders in the little script below, 
where the
current user HAS definitively write access!, if your stack is already 
present...

If not, just spit it out :-D

on xxx
   ## Check platform and the appropriate "prefs"-folder...
   switch the platform
   case "MacOS"
     put specialFolderPath("preferences") into spfp
     break
   case "Win32"
     if the systemversion contains "NT" then
       ## Win 2000 and XP
       put specialFolderPath(35) into spfp
     else
       ## Win 95, 96, 97, 98, 99 :-D
       put specialfolderpath("system") into spfp
       ### a.k.a. "The black hole"
     end if
     break
   default
     ## Unix/Linux -> User home folder
     put $HOME into spfp
     break
   end switch
   if there is not a folder (spfp & "/folder of your company") then
        create folder (spfp & "/folder of your company")
   end if
## Optional :-)

   if there is not a file (spfp & "/folder of your company/stack2save") 
then
     ## probably first time...
     put the stack2save of this stack into url("binfile:" & spfp & 
"/folder of your company/stack2save")
   end if
    go stack (spfp & "/folder of your company/stack2save")
end xxx

Et voila, a definitively save-able stack :-)


Hope that helps...

> Thanks in advance,
> Kee Nethery

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de



More information about the use-livecode mailing list