beautypg.com

Isdomrequired() – Adobe Extending Dreamweaver CS4 User Manual

Page 145

background image

139

EXTENDING DREAMWEAVER CS4

Commands

Example
The following instance of

commandButtons()

defines three buttons: OK, Cancel, and Help that appear at the upper-

right corner (default position) of the dialog box:

function commandButtons(){

return new Array("OK" , "doCommand()" ,

"Cancel" , "window.close()" ,
"Help" , "showHelp()");

}

You can customize the placement and alignment of the buttons.

Example
The following instance of

commandButtons()

displays the buttons at the bottom of the dialog box. When the first

value in the return array is

PutButtonsOnBottom

, you can specify the second value as

defaultButton

along with one

of the button names. This button is selected by default and used when the Enter key is pressed. In this example, the

OKbutton

is defined as the default.

function commandButtons(){

return new Array("PutButtonsOnBottom" , "OkButton defaultButton" ,

"OK" , "doCommand()" ,
"Cancel" , "window.close()" ,
"Help" , "showHelp()");

}

Example
In the following example, the Help button is left-aligned using the

PutButtonsOnLeft.

function commandButtons(){
return new Array("PutButtonsOnBottom", "OkButton defaultButton",

"OK", "doCommand()",
"Cancel", "window.close()",
"PutButtonsOnLeft",
"Help" , "showHelp()");}

isDOMRequired()

Description
This function determines whether the command requires a valid DOM to operate. If this function returns a value of

true

or if the function is not defined, Dreamweaver assumes that the command requires a valid DOM and

synchronizes the Design and Code views of the document before executing. Synchronization causes all edits in the
Code view to update in the Design view.

Arguments
None.

Returns
Dreamweaver expects a

true

value if a command requires a valid DOM to operate;

false

otherwise.

This manual is related to the following products: