addButton.html

<HTML>

<HEAD>

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

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

<script language="Javascript">

//Global

var dFrame

//Style

DFrameAPI.include('dFrame/styles/paper/stylePaper.js')

DFrameAPI.onLoad = function(){

DFrameAPI.checkStyles(false)

DFrameAPI.setBackgroundColor('silver')

dFrameStyle.getDefaultBarStyle().setBordersWidth(1)

dFrame = new DFrame([10, 10, 90, 90], 'addButton.html', dFrameStyle)

dFrame.text = dFrame.addText('A Button is never addded to a DFrame but on the default BarLayer of the default Bar.<br>All 3 Buttons are created on the default BarLayer of the default Bar of the DFrame.', null, [5, 10])

//A Button is never addded to a DFrame but on the default BarLayer of the default Bar

//Add a button the DFrame (and create the default Bar and its default BarLayer)

//dFrame.addButton('<center>Button on DFrame<br>Click to change the text', 'thisDFrame.text.setText("New text.");thisDFrame.text.setBgNormal("#18417B")')

dFrame.addButton('<center>Button on DFrame<br>Click to change the text', 'setText1()')

//Add a button on dFrame.defaultBar (= bar created with previous button)

dFrame.addButton('<center>Button on DFrame<br>Click to change the text', 'setText2()')

//Add a button on dFrame.defaultBar (= bar created with previous button)

dFrame.bn = dFrame.getDefaultBar().addButton('<center>Button on Bar<br>Click to change the text of this Button', 'thisDFrame.bn.setText("New text")')

dFrame.show()

}

function setText1() {

dFrame.text.setText('New text.');

dFrame.text.setTextNormal('#ffffff')

dFrame.text.setBgNormal('#18417B')

}

function setText2() {

dFrame.text.setText('New text, very, very, . . . <br><br><br><br><br><br> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . large.');

dFrame.text.setTextNormal('#000000')

dFrame.text.setBgNormal('#1E66CB')

}

</script>

</HEAD>

</HTML>