Close and Remove stack from memory

Richard Gaskin ambassador at fourthworld.com
Tue Aug 16 12:53:19 EDT 2005


Stephen Barncard wrote:
> Hello, Friends,
> 
> I'm having trouble with trying to 'Close and Remove Stack from Memory' a 
> stack window in a script while working in the IDE. No matter if I use 
> the 'destroy' properties in any configuration - I still get the 
> 'conflict' dialog from the IDE.
...
> I'm saving a preferences stack to a different file name in a different 
> area to be used as a clone later for 'first time installation' of the 
> prefs file.
> 
> I want it to be saved and then have the copy go away. But the memory 
> image of the backup stays around, and if I open the prefs file, the IDE 
> complains.

I have no idea what the IDE does, but getting the engine to do what you 
need is simple (so simple I never really understood why the IDE offers a 
preference to alter this well-tested built-in behavior):

Just make sure the stack's destroyStack property is true, and whenever 
the stack is closed its copy in memory is destroyed.

However, keep in mind that any stackfile is loaded into memory as a 
whole, mainstack and its substacks.  So if the stack you're cloning is a 
substack of something that's open, your clone will need a different name 
to avoid the name conflict.

To keep such template stacks named differently than their clones I often 
append their name with "RSRC" as an arbitrary reminder to myself which 
is which, cloning them like this:

   clone stack "PrefsRSRC"
   set the name of it to "UserPrefs"
   set the filename of it to tMyFilePath
   save it


--
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list