Home > Element Reference : Menupopup

Contents

### Menupopup

A container used to display menus. It should be placed inside a menu, menulist, or menubutton element. It can contain any element but usually will contain menuitem elements. It is a type of box that defaults to vertical orientation.

More information about Menupopup

#### Attributes:

Attributes inherited from XUL Element

oncontextmenu

This event is sent to an element when the user requests to open the context menu for the element. The action to do this varies by platform, but it will typically be a right click. This handler is usually used to dynamically set the commands on a menu when the user requests to display it, or you can use onpopupshowing event. Returning false from this event handler prevents the popup from appearing.

onpopuphidden

This event is sent to a popup after it has been hidden.

onpopuphiding

This event is sent to a popup when it is about to be hidden.

onpopupshowing

This event is sent to a menupopup just before it is popped open. This handler is usually used to dynamically set the commands on a menu when the user requests to display it. Returning false from this event handler prevents the popup from appearing.

onpopupshown

This is event is sent to a popup after it has been opened, much like the onload event is sent to a window when it is opened.

position

The position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. This allows you to place the menu on one side on a button.

- after_start: The popup appears underneath the element with the popup's upper-left corner aligned with the lower-left corner of the element. The left edges of the element and the popup are aligned. This is typically used for drop-down menus.
- after_end: The popup appears underneath the element with the popup's upper-right corner aligned with the lower-right corner of the element. The right edges of the element and the popup are aligned.
- before_start: The popup appears above the element with the popup's lower-left corner aligned with the upper-left corner of the element. The left edges of the element and the popup are aligned.
- before_end: The popup appears above the element with the popup's lower-right corner aligned with the upper-right corner of the element. The right edges of the element and the popup are aligned.
- end_after: The popup appears to the right of the element with the popup's lower-left corner aligned with the lower-right corner of the element. The bottom edges of the element and the popup are aligned.
- end_before: The popup appears to the right of the element with the popup's upper-left corner aligned with the upper-right corner of the element. The top edges of the element and the popup are aligned.
- start_after: The popup appears to the left of the element with the popup's lower-right corner aligned with the lower-left corner of the element. The bottom edges of the element and the popup are aligned.
- start_before: The popup appears to the left of the element with the popup's upper-right corner aligned with the upper-left corner of the element. The top edges of the element and the popup are aligned.
- overlap: The popup appears over top of the element with the upper-left corners aligned.
- at_pointer: The popup appears at the same position as the mouse pointer.
- after_pointer: The popup appears at the same horizontal position as the mouse pointer, but vertically, it is placed just below the element.

#### Properties and Methods:

Properties and Methods inherited from XUL Element

activeChild

The currently active menu item. You can modify this value to select a particular menu item.

autoPosition Moz0.9.5
enableKeyboardNavigator ( enable ) Moz0.9.5

enableRollup ( enable ) Moz0.9.5

hidePopup
moveTo ( x , y ) Moz0.9.5

Moves the popup to a new location.

openPopup ( element, x , y , popupType, anchor, align )

Opens a popup menu at the position (x,y) relative to the element. Type should be either the string "popup", "context" or "tooltip". The parameter anchor corresponds to the popupanchor attribute on the element. The parameter align corresponds to the popupalign attribute on the element.

popupBoxObject Moz0.9.5

This read-only property holds the nsIPopupBoxObject that implements the popup.

sizeTo ( width , height ) Moz0.9.5

Changes the current size of the popup to a new width and height.

Copyright (C) 1999 - 2002 XULPlanet.com