Example
On a toolbar that has Undo and Redo buttons, each button calls the menu command file,
Edit_Clipboard.htm, and passes an argument that specifies the action, as shown in the
following example:
<button id="DW_Undo"
image="Toolbars/images/MM/undo.gif"
disabledImage="Toolbars/images/MM/undo_dis.gif"
tooltip="Undo"
file="Menus/MM/Edit_Clipboard.htm"
arguments="'undo'"
update="onEveryIdle"/>
<button id="DW_Redo"
image="Toolbars/images/MM/redo.gif"
disabledImage="Toolbars/images/MM/redo_dis.gif"
tooltip="Redo"
file="Menus/MM/Edit_Clipboard.htm"
arguments="'redo'"
update="onEveryIdle"/>
The toolbar command API
In many cases where you specify a script for an attribute, you can also implement the attribute
through a JavaScript function in a command file. This action is necessary when the functions
need to take arguments, as in the command handler for a text box. It is required for pop-up
menus and combo boxes.
The command file API for toolbar items is an extension of the menu command file API, so you
can reuse menu command files directly as toolbar command files, perhaps with some additional
functions that are specific to toolbars.
canAcceptCommand()
Availability
Dreamweaver MX.
Description
Determines whether the toolbar item is enabled. The enabled state is the default condition for an
item, so you should not define this function unless it returns a
Arguments
For pop-up menus, combo boxes, text boxes, and color pickers, the first argument is the current
value within the control. The
IDs to items within a pop-up menu. If the selected item in the pop-up menu has an ID attached,
Dreamweaver passes that ID to
the current contents of the text box do not match an entry in the pop-up menu, Dreamweaver
passes the contents of the text box. Dreamweaver compares against the pop-up menu without
case-sensitivity to determine whether the contents of the text box match an entry in the list.
If you specify the
arguments are passed next. If you did not specify the
the ID of the item.
getDynamicContent()
canAcceptCommand()
attribute for this toolbar item in the toolbars.xml file, those
arguments
value in at least one case.
false
function can optionally attach individual
instead of the value. For combo boxes, if
attribute, Dreamweaver passes
arguments
The toolbar command API
187
Need help?
Do you have a question about the DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER and is the answer not in the manual?
Questions and answers