User Guide
194 Chapter 9: Toolbars
Arguments
None.
Returns
Dreamweaver expects a Boolean value: true if the item appears; false otherwise.
Example
function showif()
{
var retval = false;
var dom = dw.getDocumentDOM();
if(dom)
{
var view = dom.getView();
if(view == ‘design’)
{
retval = true;
}
}
return retval;
}
A simple toolbar command file
This simple example implements a Title text box item as seen on the Dreamweaver document
toolbar. The text box item lets the user enter a name for the current Dreamweaver document. You
can implement this toolbar example by performing the following steps:
1 Creating the text box item
2 Writing the JavaScript code
3 Placing the file in the Toolbars folder
Creating the text box
The following toolbar
editcontrol item defines a text-editing box that is labelled Title:
<EDITCONTROL ID="DW_SetTitle"
label="Title: "
tooltip="Document Title"
width="150"
file="Toolbars/MM/EditTitle.htm"/>
The tooltip attribute causes Dreamweaver to display Document Title in a tooltip box when the
user places the cursor over the text box. The width attribute specifies the size of the field in pixels.
The file attribute specifies that the EditTitle.htm file contains the JavaScript functions that
operate on the text box.
The following figure shows the Title
text-editing box: