Adobe Extending Dreamweaver CS4 User Manual
Page 141
135
EXTENDING DREAMWEAVER CS4
Commands
Otherwise,
canAcceptCommand()
returns the value
false
and Dreamweaver dims the item, as shown in the following
figure:
Link functions to the OK and Cancel buttons
When the user clicks OK or Cancel, the extension needs to perform the appropriate action. You determine the
appropriate action by specifying which JavaScript function to perform when either button is clicked.
1
Open the file Change Case.js in the Configuration/Commands folder.
2
At the end of the file, add the following code:
function commandButtons() {
return new Array("OK", "changeCase()", "Cancel", "window.close()");
}
3
Save the file.
The
commandButtons()
function causes Dreamweaver to supply the OK and Cancel buttons and tells Dreamweaver
what to do when the user clicks them. The
commandButtons()
function tells Dreamweaver to call
changeCase()
when the user clicks OK and to call
window.close()
when the user clicks Cancel.
Let the user specify uppercase or lowercase
When the user clicks a menu item, the extension needs a mechanism to let the user select uppercase or lowercase. The
UI provides this mechanism by defining two radio buttons to let the user make that choice.
1
Open the file Change Case.js.
2
At the end of the file, add the following code: