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.
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.
- start: The text will be cropped on its left side.
- end: The text will be cropped on its right side.
- left: (Deprecated) The text will be cropped on its left side.
- right: (Deprecated) The text will be cropped on its right side.
- center: The text will be cropped on both sides.
- none: The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment.
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.
- none: The width of the popup will not be constrained to the size of the menu.
- always: If set to always, the menu's width will be the same as that necessary for the menupopup. If the menu has a maximum width, the popup will also be this width.
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:
Inherited from Element: