Do you want to save changes to this stack ..... ?

Francis Nugent Dixon effendi at
Wed Mar 1 11:10:29 EST 2006

Hi from Paris,

I have a relatively big stack (4000 cards, 6 Mb). When I run it, most 
times I just do calculations on card 1 whose results are stored on this 
card. In this case, from my point of view, there are no mods (although 
I agree that SOME fields on card 1 have changed, but I don't want to 
save the stack). Sometimes I add data cards, and so I do want to save 
the stack on exit.

You can quit a stack in three ways, by (a) executing a "close stack" 
command, (b) by clicking top left (Mac), or (c) by quitting Revolution. 
Obviously, if I use methods (a) or (b), and answer "No" to the save 
request, when I open the stack again in the SAME Revolution session, 
any mods I made are there, because the stack is still in memory. If I 
use methods (a) or (b) with no save, and then quit Revolution, I lose 
my mods. I can go with that - it seems perfectly normal.

Questions :

1 - Under what conditions does Revolution ask me the question "Do you 
want to save the changes ", or more simply, what constitutes "a change" 
? The answer once seemed clear to me, but maybe there are things I 
don't know ! As an example, if I change the contents of a field, I get 
the request to save, but if I change the labels from English to French 
(by buttons), I don't get the request to save. Yet I made modifications 
to the stack ! And when I execute the stack again, label modifications 
have been lost. Curiouser and Curiouser !

2 - Are the conditions the same under Stack Runner ?

And the most important question :

3 - If I consider that I have made no changes, and Revolution doesn't 
agree, can I bypass the "Do you want to save?" request (maybe there is 
a gREV global that I can tinker with) ?

ASSUMING the answer to question (3) is YES, I want to handle the "save" 
problem myself in the Stack Script :

      global IveModifiedTheStack
      on newCard             -- I call "newCard" in a main-line script.
         create card
         put 1 into IveModifiedThe Stack
      end newCard

      on closeStack
         if IveModifiedTheStack = 1 then save this stack -- otherwise 
DON'T save !
      end closeStack

I tried using "saveStackRequest" and not passing it, but this doesn't 
appear to work, and it appears to be called AFTER the Revolution "Do 
you want to save" question, thus defeating the object :

on saveStackRequest
   global IveModifiedTheStack
   if IveModifiedTheStack ­ 1 then exit saveStackRequest
   pass saveStackRequest  -- Leave Revolution to decide.
end saveStackRequest

Is this the correct way to attack the problem (I hope all this is clear 
to you guys) ?


More information about the Use-livecode mailing list