DFrame: addContextMenu

DFrame: useContextMenu

DFrame.addContextMenu: Create a context Menu (Menu object) directly on the DFrame (not on a default Bar). This Menu is activated by a right-click of the mouse.

DFrame.useContextMenu: Many context Menus can be added to a DFrame. The useContextMenu activate the one selected.

Example

var popUpMenu = new Array()
popUpMenu[1] = new Array('Button', 'New', 'newFunction()')
popUpMenu[2] = new Array('Button', 'Exit', 'exitFunction()')
var menu = dFrame.addContextMenu(popUpMenu, menuStyle)

Demo

file: addMenu-1.html

Run the example
See the source code

Syntaxes

DFrame.addContextMenu(buttonsArrayDefinition[, menuStyle])

DFrame.useContextMenu(Context Menu)

Parameters

buttonsArrayDefinitions

See the buttonsArrayDefinition

The buttonsArrayDefinitions can, for this method, be an array of menuArrayDefinitions and already created Menus. This allow to concatenate existing menus and new definitions. See usages for more details.

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.

Context Menu

useContextMenu method. Can be

§         the name of the Menu to select

§         false: Inactivate all ContextMenus

§         true activate the ContextMenus

Return value

Menu object.

Usage

The addContextMenu method is a method of the DFrame class as the addMenu is a method of the Bar class that can be used on a DFrame with the implicit creation of a defaut Bar.

The contexts Menus have no associated Button, even when they are pop-up Menus.

Concatenation of Menus.

The menuArraydefinition parameter can be an array of menuArrayDefinitions and previously created Menus.

Example:

//Define first Menu
var popUpMenu = new Array()
popUpMenu[1] = new Array('Button', 'New', 'newFunction()')
popUpMenu[2] = new Array('Button', 'Exit', 'exitFunction()')
var baseDFrame = new DFrame(parameters)
var
baseMenu = baseDFrame.addContextMenu(popUpMenu)

//Define a pop-up Menu wich will be concatenated to the previous one
var popUpMenu = new Array()
docPopUpMenu[1] = new Array('Button', 'Close', closeFuntion)
docPopUpMenu[2] = new Array('Button', 'Edit', 'editFunction()')
var documentDFrame = new DFrame(parameters)
documentDFrame.
addContextMenu([docPopUpMenu, baseMenu])

The context Menu created for the documentDFrame DFrame will show the baseMenu and the new created Menu defined by the docPopUpMenu array.

The following syntax should produce the same result:

documentDFrame.addContextMenu([docPopUpMenu, popUpMenu])

Add a task Menu as a context Menu

Task Menus are Menus storing opened DFrames. It is possible to create a task Menu as a context Menu by using the 'TaskMenu' keyword (not case sensitive) as menuArrayDefinitions:

dFrame.addContextMenu('TaskMenu')