Saving substacks in stand alones

Ken Norris pixelbird at interisland.net
Sat Mar 13 21:02:28 EST 2004


Hi Spence,

> Date: Sat, 13 Mar 2004 14:40:50 -0600
> From: James Spencer <jspencer78 at mac.com>
> Subject: Saving substacks in stand alones

> a) Considering that the data stack is not a substack of the main stack
> but rather is  a completely separate entity in its own file, why does
> the doFileSave message get sent to the main stack?
-----------
Revvers please call me on it if I make a drastic error explaining this.

Well, it still operates as a substack because files don't have engines. In a
standalone, the runtime engine is in the Main stack, therefore it's at the
end of the hierarchy. The engine is "running" the datastack file, and
commands get processed by the engine, which is in the Main stack.

The Main stack keeps a record of what datastacks (substacks) are llnked to
it along with filepaths, the default setting being called the defaultFolder
where the Main stack and all the substacks are put at build time, and is
threfore a 'relative' filepath, doesn't need anything but the filename
-----------
> b) How does the "this" work in the line above?  Does "this stack" refer
> to the stack from which the message was sent?
-----------
Yes, I think so. It's the one still linked in the filepath, so it is still
"this stack".

Operation in the IDE is really just a special case setup of the same thing.
The "Main" stack, while you are working in the IDE, is just a file, while
substacke are really just other windows which belong to that file. The
engine resides in the IDE.

At build time, the engine is copied into the Main stack and substacks get
separated out as files which belong to it, all of it in the default folder.
But you could put the substacks somewhere else, i.e., in another folder, as
long as you establish relative (call the folder the defaultfolder) or
absolute (long file name) filepaths in the Main stack as to where they
reside.

I hope this makes some sense.

Ken N.



More information about the use-livecode mailing list