<doc>
  <legacy_id>2077</legacy_id>
  <name>mainStack</name>
  <type>property</type>
  <syntax>
    <example>set the mainStack of <i>stack</i> to <i>mainStack</i></example>
  </syntax>
  <library></library>
  <objects>
    <stack/>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Objects &amp; Messages</category>
  </classification>
  <references>
    <function tag="mainStacks">mainStacks Function</function>
    <property tag="stackFiles">stackFiles Property</property>
    <message tag="mainStackChanged">mainStackChanged Message</message>
    <command tag="revert">revert Command</command>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary>Specifies which <glossary tag="main stack">main stack</glossary> a <glossary tag="substack">substack</glossary> belongs to.</summary>
  <examples>
    <example>set the mainStack of this stack to "Central"</example>
    <example>go the mainStack of stack "/Disk/Folder/file.rev"</example>
    <example>set the mainStack of stack "Hello" to "Goodbye"</example>
  </examples>
  <description>
    <p>Use the <b>mainStack</b> <glossary tag="property">property</glossary> to organize <function tag="stacks">stacks</function> in <function tag="files">files</function>.</p><p/><p><b>Value:</b></p><p>The <b>mainStack</b> of a <object tag="stack">stack</object> is a <keyword tag="string">string</keyword>, which is the short <property tag="name">name</property> of a <object tag="stack">stack</object>.</p><p/><p>By default, the <b>mainStack</b> <glossary tag="property">property</glossary> of newly created <function tag="stacks">stacks</function> is set to the new <object tag="stack">stack</object> itself.</p><p/><p><b>Comments:</b></p><p>Each LiveCode file contains either a single main stack, or a main stack and one or more substacks. You can use this capability to bundle several related stacks into a single file for easy distribution, or to organize the stacks into categories, or to allow several stacks to inherit properties from the same main stack.</p><p/><p>The <b>mainStack</b> of a <glossary tag="stack file">stack file</glossary> is the <glossary tag="main stack">main stack</glossary> in that <keyword tag="file">file</keyword>. (Each <glossary tag="stack file">stack file</glossary> can have only one <glossary tag="main stack">main stack</glossary>.)</p><p/><p>The <b>mainStack</b> of a <glossary tag="main stack">main stack</glossary> is itself.</p><p/><p>The <b>mainStack</b> of a <glossary tag="substack">substack</glossary> is the <glossary tag="main stack">main stack</glossary> in that <glossary tag="substack">substack's</glossary> file.</p><p/><p>Changing a stack's <b>mainStack</b> <glossary tag="property">property</glossary> moves it into the same <keyword tag="file">file</keyword> as the specified <glossary tag="main stack">main stack</glossary>. The <i>stack</i> becomes a <glossary tag="substack">substack</glossary> of the specified <i>mainStack</i>.</p><p/><p>Changing a substack's <b>mainStack</b> <glossary tag="property">property</glossary> to itself makes the <glossary tag="substack">substack</glossary> into an independent <glossary tag="main stack">main stack</glossary> (and removes it from the original <glossary tag="main stack">main stack's</glossary> <property tag="substacks">substacks</property> property). The next time you save the <object tag="stack">stack</object>, LiveCode will <glossary tag="prompt">prompt</glossary> you for a file name and location for the <object tag="stack">stack</object>.</p><p/><p>You can set the <b>mainStack</b> property of a <object tag="stack">stack</object> to the name of any open <object tag="stack">stack</object>.</p><p/><p><code/><b>Note:</b><code/> The <b>mainStack</b> <glossary tag="property">property</glossary> is simply the short <property tag="name">name</property> of the <glossary tag="main stack">main stack</glossary>, not a full <href tag="reference/object_reference.rev">stack reference</href>.</p>
  </description>
</doc>