A container used to display the contents of a popup menu. When a menupopup is open, it floats above the window and may extend outside the window border. There are several ways in which a menupopup may be used:
toolbarbutton, or a
buttonwith the type attribute set to "menu" to create a popup that will open when the menu or button is pressed.
popupattribute. When the element is clicked with the left mouse button, the menupopup will be displayed.
contextattribute. When a context menu is opened, the menupopup will be displayed. A context menu may be opened by right-clicking the element, or by pressing the menu key on the keyboard.
More information is available in the XUL tutorial and Popup Guide.
The following example shows how a menupopup may be attached to a
<menulist> <menupopup> <menuitem label="Mozilla" value="http://mozilla.org"/> <menuitem label="Slashdot" value="http://slashdot.org"/> <menuitem label="Sourceforge" value="http://sf.net"/> <menuitem label="Freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist>
The following example shows how a menupopup can be used as a context menu for an element. When the label is right-clicked, the menu will be displayed.
<menupopup id="clipmenu"> <menuitem label="Cut"/> <menuitem label="Copy"/> <menuitem label="Paste"/> </menupopup> <label value="Right click for popup" context="clipmenu"/>
true, keyboard navigation between items in the popup is disabled.
falsefrom this event handler prevents the popup from appearing.
onloadevent is sent to a window when it is opened.
positionattribute determines where the popup appears relative to the element the user clicked to invoke the popup. This allows you to place the popup on one side of a button. Note that a context menu will never respect this attribute, always appearing relative to the mouse cursor.
bottomcenter. The popup value (ie, the second word) can be one of
closed: The popup is closed and not visible.
open: The popup is open and visible on screen.
showing: A request has been made to open the popup, but it has not yet been shown. This state will occur during the popupshowing event.
hiding: The popup is about to be hidden. This state will occur during the popuphiding event.
moveTo( x, y )
openPopup( anchor , position , x , y , isContextMenu, attributesOverride, triggerEvent )
Opens the popup relative to a specified node at a specific location.
nullas the anchor node. The direction in which the popup is oriented depends on the direction of the anchor.
after_pointer. Check Positioning of the Popup Guide for a precise description of the effect of the different values.
yarguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. In this case, the
attributesOverridearguments are ignored.
isContextMenuargument should be
truefor context menus and
falsefor all other types of popups. It affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items.
true, the position attribute on the popup node overrides the
positionvalue argument. If
false, the attribute is only used if the
positionargument is empty.
openPopupAtScreen( x, y, isContextMenu )
showPopup( element, x, y, popupType, anchor, align )Deprecated since Gecko 1.9
-1, the popup will be positioned relative to the element specified as the first argument. This is what you might do to show a popup below a button, for example. In this latter case, the anchor and align arguments may be used to further control where the popup appears relative to the element. The anchor argument corresponds to the
popupanchorattribute on the element. The align argument corresponds to the
popupalignattribute on the element. The anchor and align arguments are ignored if either x or y are not
boxObject.screenY properties of the element, and use those as the x and y arguments offset by the desired values.
tooltip. Each type of popup is intended to be displayed only temporarily; they are not expected to be displayed permanently.
sizeTo( width, height )