addMenu-3.html

<HTML>

<HEAD>

<script>var dFrameFilePath = '../../../'</script>

<script language="Javascript" src="../../../lib/dFrameAPI.js"></script>

<script language="Javascript">

//Style

DFrameAPI.include('styles/blue/styleBlue.js')

DFrameAPI.onLoad = function(){

var dFrame = new DFrame([10, 10, 90, 90], addMenu-3.html', dFrameStyle)

var ssM = new Array()

ssM[0] = ['Button', 'sub1-sub2--item1', 'alert("Click !")']

ssM[1] = ['Button', 'sub1-sub2-item2', 'alert("Click !")']

var sM = new Array()

sM[0] = ['Button', 'sub1-item1', ssM]

sM[1] = ['Button', 'sub1-item2', 'alert("Click !")']

var M = new Array()

M[0] = ['Button', 'item1', sM]

M[1] = ['Button', 'item2', 'alert("Click !")']

//-- Menu 1

//use an array for borders width: No borders for the sub-level

dFrame.getStyle().getDefaultBarStyle().getDefaultMenuStyle().setBordersWidth([1, 1])

dFrame.addText('The pop-up Menu is used to create the context Menu.',[10,10])

var bar = dFrame.addBar('', 'TOP')

var menu1 = bar.addMenu(M)

menu1.setIsTree(false)

//-- Menu 2

var N = new Array()

N[0] = ['Button', 'Context item1', 'alert("Click !")']

N[1] = ['Button', 'Context item2', 'alert("Click !")']

var menu2 = dFrame.addContextMenu([N, menu1])

menu2.setWidth(200)

menu2.setBackgroundColor('#637D9C')

dFrame.show()

}

</script>

</HEAD>

</HTML>