<doc>
  <legacy_id>1278</legacy_id>
  <name>mainStackChanged</name>
  <type>message</type>
  <syntax>
    <example>mainStackChanged</example>
  </syntax>
  <library></library>
  <objects>
    <stack/>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Objects &amp; Messages</category>
  </classification>
  <references>
    <property tag="mainStack">mainStack Property</property>
  </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>Sent to a <object tag="stack">stack</object> when its <property tag="mainStack">mainStack</property> is changed.</summary>
  <examples>
    <example>on mainStackChanged <code><i>-- in a main stack's script</i></code></p><p>  save me <code><i>-- save the stack file when a substack is added</i></code></p><p>end mainStackChanged</example>
  </examples>
  <description>
    <p>Handle the <b>mainStackChanged</b> <keyword tag="message box">message</keyword> if you want to respond when a <glossary tag="substack">substack</glossary> is moved to another <glossary tag="stack file">stack file</glossary>.</p><p/><p><b>Comments:</b></p><p>Each stack file consists of a main stack, and may also include one or more substacks. To move a stack to another file, you set its <b>mainStack</b> property to the name of the main stack of the destination file. The moved stack becomes a substack of the main stack you specified.</p><p/><p>The <b>mainStackChanged</b> message is sent right after the stack is moved to the new stack file. This means that (if the substack does not trap the message) the <b>mainStackChanged</b> message is received by the new main stack, and can be handled in the main stack's script.</p><p/><p>The <b>mainStackChanged</b> <keyword tag="message box">message</keyword> is used by the LiveCode <glossary tag="development environment">development environment</glossary>, so if you <glossary tag="handle">handle</glossary> this <keyword tag="message box">message</keyword>, be sure to <control_st tag="pass">pass</control_st> it at the end of the <glossary tag="handler">handler</glossary>.</p>
  </description>
</doc>