
The toolbar command API 239
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
false value in at least one
case.
Arguments
For pop-up menus, combo boxes, text boxes, and color pickers, the first argument is the
current value within the control. The
getDynamicContent() function can optionally attach
individual 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
canAcceptCommand() instead of the value.
For combo boxes, if 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 attribute for this toolbar item in the toolbars.xml file, those
arguments are passed next. If you did not specify the
arguments attribute, Dreamweaver
passes the ID of the item.
Returns
Dreamweaver expects a Boolean value; true if the item is enabled; false otherwise.
Example
function canAcceptCommand()
{
return (dw.getDocumentDOM() != null);
}
Komentáře k této Příručce