beautypg.com

Canacceptcommand(), Commandbuttons(), Getdynamiccontent() – Adobe Extending Dreamweaver CS4 User Manual

Page 168

background image

162

EXTENDING DREAMWEAVER CS4

Menus and menu commands

canAcceptCommand()

Description
Determines whether the menu item is active or dimmed.

Arguments
{arg1}, {arg2},...{argN}}

If it is a dynamic menu item, the unique ID that the

getDynamicContents()

function specifies is the only argument.

Otherwise, if the

arguments

attribute is defined for a

menuitem

tag, the value of that attribute passes to the

canAcceptCommand()

function (and to the

isCommandChecked()

” on page 163,

receiveArguments()

” on page 164,

and

setMenuText()

” on page 165 functions) as one or more arguments. The

arguments

attribute is useful for

distinguishing between two menu items that call the same menu command.

Note: The

arguments

attribute is ignored for dynamic menu items.

Returns
Dreamweaver expects a Boolean value:

true

if the item should be enabled;

false

otherwise.

commandButtons()

Description
Defines the buttons that appear on the right side of the Options dialog box and their behavior when they are clicked.
If this function is not defined, no buttons appear, and the body section of the Menu Commands file expands to fill the
entire dialog box.

Arguments
None.

Returns
Dreamweaver expects an array that contains an even number of elements. The first element is a string that contains
the label for the topmost button. The second element is a string of JavaScript code that defines the behavior of the
topmost button when it is clicked. The remaining elements define additional buttons in the same manner.

Example
The following example of the

commandButtons()

function defines the OK, Cancel, and Help buttons:

function commandButtons(){

return new Array("OK" , "doCommand()" , "Cancel" , ¬
"window.close()" , "Help" , "showHelp()");

}

getDynamicContent()

Description
Retrieves the content for the dynamic portion of the menu.

This manual is related to the following products: