Saving substacks in stand alones

James Spencer jspencer78 at mac.com
Sat Mar 13 15:40:50 EST 2004


Newbie question just so I can understand what is happening.  I'm not 
understanding how message passing works or how "this" works in the 
context of substacks.

I've got some old stuff I'm converting to Rev. standalones to run under 
OS X and I've been wandering through the example Employee Data Base 
just to see how it is being done.  Being Unix based, the standalone 
can't save itself so I understand why a separate stack is used.  This 
separate stack, while cloned from the main stack is a completely 
separate file.  The main stack opens or creates this separate data 
stack, brings it to the front and hides itself (the main stack).  So 
far so good.

What I don't get is how the file saving code works.  The menu handler 
for file menu items in the data stack is in the card script for the 
currently displayed card; the Save menu choice calls doFileSave.  There 
is no doFileSave in the card script nor in that card's stack so it ends 
up going to the "main" stack where it is executed.  The file itself 
gets saved in the "main" stack's script where the handler calls, after 
some setup stuff:

save this stack

What I don't get and hope that some kind soul will tell me is:

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?  I can surmise that 
the main stack of a stand alone application is always in the message 
chain but that doesn't explain to me why that works even within the 
Revolution Environment where I can have lots of stacks open.

b) How does the "this" work in the line above?  Does "this stack" refer 
to the stack from which the message was sent?

Thanks for the help.

Spence

James P. Spencer
Rochester, MN

jspencer78 at charter.net

"Badges??  We don't need no stinkin badges!"



More information about the use-livecode mailing list