object = DFrame, Bar or BarLayer

object: addMenu

DFrame.addMenu: Create the default Bar and the default BarLayer if the default Bar if not yet created and create a Menu on the default BarLayer of the default Bar.

Bar.addMenu: Create a Menu on the default BarLayer of the specified Bar.

BarLayer.addMenu: Create a Menu on the specified BarLayer.

Example

var menu = dFrame.addMenu(menuArrayDefinitions, menuStyle)

Demo

file: addMenu-1.html

Run the example
See the source code

file: addMenu-2.html

Run the example
See the source code

file: addMenu-3.html

Run the example
See the source code

Syntaxes

object.addMenu(buttonsArrayDefinition[, menuStyle[, menuTitle[, buttonStyle]]], position)

Parameters

buttonsArrayDefinitions

See the buttonsArrayDefinition

menuStyle

MenuStyle object. The style that will be used to draw the Menu. Set menuStyle to null to use the default MenuStyle property of the styles of the Menu's parent.

menuTitle

Pop-up Menu only. String. The text of the Button that will be created to handle the Menu.

buttonStyle

Pop-up menus only. ButtonStyle object. The style that will be used to draw the Button that will be created to open the Menu. Set buttonStyle to null to use the default ButtonStyle property of the styles of the Button's parent.

position

See position

Return value

Menu object.

Usage

A Menu is a group of buttons been subject to certain rules of presentation and operation. Each item of the Menu is a Button and behaves like such. It is what explains the similarity of the syntax of the addButtons method that creates a group of buttons and addMenu method that creates a Menu. 

There are two kinds of menus: The pop-up Menus that correspond to the usual menus of the graphic interfaces and the tree Menu that correspond to tree structures.

The type of Menu created will depend on the setIsTree() property of the Style of the Menu:

var menuStyle = new MenuStyle()
menuStyle.setIsTree(false)
var menu = dFrame.addMenu(menuArrayDefinitions, menuStyle)

create a pop-up Menu.