<doc>
  <legacy_id>2073</legacy_id>
  <name>topStack</name>
  <type>function</type>
  <syntax>
    <example>the topStack</example>
    <example>topStack()</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
    <synonym>topWindow</synonym>
    <synonym>currentWindow</synonym>
  </synonyms>
  <classification>
    <category>Windows &amp; Dialog Boxes</category>
  </classification>
  <references>
    <function tag="mainStacks">mainStacks Function</function>
  </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><glossary tag="return">Returns</glossary> the long <property tag="name">name</property> of the topmost <object tag="stack">stack</object>.</summary>
  <examples>
    <example>the topStack</example>
    <example>set the defaultStack to the topStack</example>
  </examples>
  <description>
    <p>Use the <b>topStack</b> <control_st tag="function">function</control_st> to find out which <object tag="stack">stack</object> is in the <glossary tag="current stack">current stack</glossary>.</p><p/><p><b>Value:</b></p><p>The <b>topStack</b> <glossary tag="return">returns</glossary> the long <property tag="name">name</property> of a <object tag="stack">stack</object>.</p><p/><p><b>Comments:</b></p><p>In most applications, the active window holds the current document, and menu commands operate on the active window. In LiveCode, because of the ability to open stacks in various modes, this is not necessarily the case.</p><p/><p>Each open window has a <b>mode</b> associated with it. The <b>topStack</b> is the frontmost stack with the lowest <property tag="mode">mode</property>.</p><p/><p>For example, an editable window has a <b>mode</b> of 1, and a <command tag="palette">palette</command> has a mode of 4. If several <glossary tag="palette">palettes</glossary> and <glossary tag="editable window">editable windows</glossary> are open, the <b>topStack</b> is the frontmost editable <object tag="stack">stack</object>, although <glossary tag="palette">palettes</glossary> may be in front of it. If all the <glossary tag="editable window">editable windows</glossary> are then closed, the frontmost <command tag="palette">palette</command> becomes the <b>topStack</b>, since there is now no window with a lower <property tag="mode">mode</property>.</p>
  </description>
</doc>