Menu

An element, much like a button, that is placed on a menu bar. When the user clicks the menu element, the child menupopup of the menu will be displayed. This element is also used to create submenus.

More information about menu

The menu element implements the following interfaces:

nsIAccessibleProvider   nsIDOMXULSelectControlItemElement  

Attributes:

acceltext accesskey allowevents crop disabled
key label menuactive open sizetopopup
value

Properties and Methods:

value

Attributes:

Inherited from XUL Element:

align
allowevents
allownegativeassertions
class
coalesceduplicatearcs
collapsed
container
containment
context
contextmenu
datasources
dir
empty
equalsize
flags
flex
height
hidden
id
insertafter
insertbefore
left
maxheight
maxwidth
menu
minheight
minwidth
mousethrough
observes
ordinal
orient
pack
persist
popup
position
preference-editable
ref
removeelement
sortDirection
sortResource
sortResource2
statustext
style
template
tooltip
tooltiptext
top
uri
wait-cursor
width

acceltext

Type: string

Text that appears beside beside the menu label to indicate the shortcut key (accelerator key) to use to invoke the command. If this value is set, it overrides an assigned key set in the key attribute. This attribute does not apply to menus directly on the menubar.

accesskey

Type: character

This should be set to a letter that is used as a shortcut key. This letter should be one of the characters that appears in the label text for the menu. This letter will typically be drawn underlined, although this behavior will be platform and theme specific. When the user presses ALT (or a similar key that varies on each platform) and the access key, the menu will be activated from anywhere in the window. Although the value is case insensitive, a letter with the case matching the accesskey attribute will used if both cases exist in the label.

allowevents

Type: boolean

If true, events are passed to children of the menu. Otherwise, events are passed to the menu only.

crop

Type: one of the values below

If the label of the menu is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed.

disabled

Type: boolean

Indicates whether the menu is disabled or not. If this attribute is set to true, the menu is disabled. This is usually drawn with the text in grey. If the menu is disabled, it does not respond to user actions. The element cannot be focused and the command event will not fire. The element will still respond to mouse events. To enable the menu, leave the attribute out entirely as opposed to setting the value to false.

key

Type: key element id

The id of a key element that is used as the menu command's shortcut key. If used, text will be displayed beside the menu label to indicate which keys can be pressed to invoke the command. Normally, you would not set a key on a menu element.

label

Type: string

The label that will appear on the menu. If this is left out, no text appears.

menuactive

Type: boolean

This attribute is set on an item in a menu when it is being hovered over. Typcially, the theme will use this to highlight the item. A DOMMenuItemActive event will be sent to the item when the item is hovered over, and a DOMMenuItemInactive event will be sent to the item when the selection moves away.

open

Type: boolean

This attribute is set on the menu when it is open. To open the menu, call the showPopup method of the menupopup.

sizetopopup

Type: string

Indicates how the menu width and the popup width are determined. If the sizetopopup attribute is left out or set to none, the menu will be its preferred width and the popup may extend outside of this width, unaffected by the maximum width of the menu itself.

value

Type: string

A value associated with the menu. You may use it in a script for your own purposes.


Properties and Methods:

value

Type: string

A value associated with the menu. You may use it in a script for your own purposes.

Inherited from XUL Element:

align allowEvents blur boxObject boxObject.element
boxObject.getLookAndFeelMetric boxObject.height boxObject.screenX boxObject.screenY boxObject.width
boxObject.x boxObject.y builder className click
collapsed contextMenu controllers database datasources
dir doCommand flex focus getElementsByAttribute
height hidden id left maxHeight
maxWidth menu minHeight minWidth observes
ordinal orient pack persist ref
resource statusText style tooltip tooltipText
top width

Inherited from Element:

addEventListener
appendChild
attributes
childNodes
cloneNode
dispatchEvent
firstChild
getAttribute
getAttributeNS
getAttributeNode
getAttributeNodeNS
getElementsByTagName
getElementsByTagNameNS
hasAttribute
hasAttributeNS
hasAttributes
hasChildNodes
insertBefore
isSupported
lastChild
localName
namespaceURI
nextSibling
nodeName
nodeType
nodeValue
normalize
ownerDocument
parentNode
prefix
previousSibling
removeAttribute
removeAttributeNS
removeAttributeNode
removeChild
removeEventListener
replaceChild
setAttribute
setAttributeNS
setAttributeNode
setAttributeNodeNS
tagName

Copyright (C) 1999 - 2004 XulPlanet.com