<doc>
	<legacy_id>2247</legacy_id>
	<name>popup</name>
	<type>command</type>

	<syntax>
		<example>popup {<i>stack</i> | <i>button</i>} [at <i>location</i>]</example>
	</syntax>

	<synonyms>
	</synonyms>

	<summary>Displays a <glossary tag="popup menu">popup menu</glossary> whose <glossary tag="menu item">menu items</glossary> are either lines in a <keyword tag="button">button</keyword> or <glossary tag="button">buttons</glossary> in a <object tag="stack">stack</object>.</summary>

	<examples>
<example>popup button "Contextual Menu"</example>
<example>popup stack "Button Properties"</example>
<example><p>on mouseDown theButton</p><p>   -- pop up the menu on right-click or control-click</p><p>   if theButton is 3 then popup stack "Lookup Options"</p><p>   else pass mouseDown</p><p>end mouseDown</p></example>
	</examples>

	<history>
		<introduced version="1.0">Added.</introduced>
		<deprecated version=""></deprecated>
		<removed version=""></removed>
		<changed version="2.0">2.0</changed>
		<experimental version=""></experimental>
		<nonexperimental version=""></nonexperimental>
	</history>

	<objects>
	</objects>

	<platforms>
		<mac/>
		<windows/>
		<linux/>
	</platforms>

	<classes>
		<desktop/>
		<server/>
		<web/>
	</classes>

	<security>
	</security>


	<classification>
		<category>Menus</category>
		<category>Math, Logic, &amp; Dates</category>
	</classification>

	<references>
		<function tag="clickLoc">clickLoc Function</function>
		<command tag="pulldown">pulldown Command</command>
		<property tag="toolTip">toolTip Property</property>
		<keyword tag="popup">popup Keyword</keyword>
	</references>

	<description>
	<overview>Use the <b>popup</b> command to display a contextual menu.</overview>

		<parameters>
  <parameter>
    <name>stack</name>
    <description>Any stack reference. The stack's first card contains a button for each menu item in the popup menu.</description>
  </parameter>
  <parameter>
    <name>button</name>
    <description>A reference to a button on the current card</description>
  </parameter>
  <parameter>
    <name>location</name>
    <description>A point or expression that evaluates to a point. Two integers separated by a comma.</description>
  </parameter>		</parameters>

	<value></value>
	<comments>Use the <b>popup</b> command in a <message tag="mouseDown">mouseDown</message> handler to display the menu. <p></p><p>The popup menu appears with its top left corner at the <i>location</i>. If no <i>location</i> is specified, the menu's top left corner is at the <function tag="mouseLoc">mouse location</function>. While the popup menu is displayed, the handler pauses.</p><p></p><p>Choosing a menu item from the popup menu sends a <message tag="menuPick">menuPick message</message> to the button (for a button menu) or a <message tag="mouseUp">mouseUp message</message> to the clicked control in the stack (for a stack menu). The button or stack menu handles the menu choice.</p><p></p><p>If you use a button to hold the contents of the menu, the contents of the button's <keyword tag="menuItem">menuItem Keyword</keyword> is displayed in the popup. </p><p></p><p></p><important> If you use a button to hold the contents of the menu, the following properties must be set:</important><p>- <property tag="style">style property</property> must be set to "menu"</p><p>- <property tag="menuMode">menuMode property</property> must be set to "popup"</p><p>- <property tag="visible">visible property</property> may be set to either true or false.</p><p></p><p></p><important> You must escape reserved characters in the button's <keyword tag="menuItem">menuItem Keyword</keyword>. These include:</important><p>- &amp; (To display the string "A&amp;B" in the popup menu, use "A&amp;&amp;B")</p><p>- \ (To display the string "A\B" in the popup menu, use "A\\B")</p><p>- / (To display the string "A/B" in the popup menu, use "A//B")</p><p></p><p></p><important> The <property tag="menuMouseButton">menuMouseButton property</property> of a button used with the <b>popup</b> command must be set to zero. Setting it to any other value may result in unexpected behavior when the menu is used. To control which mouse buttons may be used to access the menu, use the mouse button parameter of the <message tag="mouseDown">mouseDown message</message>, as described above.</important></comments>
	</description>
</doc>