Saving substacks in stand alones

James Spencer jspencer78 at mac.com
Sun Mar 14 09:43:54 EST 2004


On Mar 13, 2004, at 10:31 PM, J. Landman Gay wrote:

> On 3/13/04 2:40 PM, James Spencer wrote:
>
>> 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.
>
> Rev has the ability to insert scripts of any object into either the 
> front or the back of the hierarchy. If you look at the script on card 
> 1 of the data stack, you'll find an explanation of how the tutorial 
> overcomes exactly the problem you describe. A preOpenCard handler 
> inserts the script of the main stack into the back of the hierarchy. 
> As you figured, in a standalone this script would always be available 
> automatically, but while working in the IDE an insertion is necessary.

This is what I was looking for and in fact actually read without 
understanding its significance.  Thank you.  BTW, just in case someone 
else is reading this, the preOpenCard handler Jacque mentions here is 
in the script of card one of the main stack; the scripts of the data 
stack cards are empty.

>
>> b) How does the "this" work in the line above?  Does "this stack" 
>> refer to the stack from which the message was sent?
>
> It refers to the current default stack, which is often, or even 
> usually, the one that originated the message. It is possible to change 
> which stack is the default stack though ("set the defaultstack to...") 
> at which point "this stack" means, um, that one.

...and my going back to reading the Transcript Dictionary entry for the 
default stack property makes this even clearer.  Thank you again.  (I 
would suggest that "this" is counterintuitive in this context: at least 
for me, I expect "this" to be the stack in which the script is found 
but now I'm whining.)

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