
154 Insert Bar Objects
■ Each button tag in the XML file places an icon on the Insert bar and connects it to the
proper HTML file or function.
To add the new object to the Insert bar:
1. Find the following line near the beginning of the inserbar.xml file:
<category id="DW_Insertbar_Common" MMString:name="insertbar/category/
common" folder="Common">
This line identifies the beginning of the Common category on the Insert bar.
2. Start a new line after the category tag; then insert the button tag and assign it the id,
image, and file attributes for the Strikethrough object.
The ID must be a unique name for the button (following standard naming conventions,
use
DW_Text_Strikethrough for this object). The image and file attributes simply tell
Dreamweaver the location of the supporting files, as shown here:
<button id="DW_Text_Strikethrough"
image="Text\Strikethrough.gif"
file="Text\Strikethrough.htm"/>
3.
Save the insertbar.xml file.
4. Reload the extensions (see “Reloading extensions” on page 104).
The new object appears at the beginning of the Common category on the Insert bar, as shown
in the following figure:
Adding a dialog box
You can add a form to your object to let the user enter parameters before Dreamweaver inserts
the specified code (for example, the Hyperlink object requests the text, link, target, category
index, title, and access key values from the user). In this example, you add a form to the
Strikethrough object from the previous example. The form opens a dialog box that provides
the user with the option to change the text color to red as well as add the strike-through tag.
This example assumes you have already created a separate JavaScript file called
Strikethrough.js.
First, in Strikethrough.js, you add the function that the form calls if the user changes the text
color. This function is similar to the
objectTag() function for the Strikethrough object, but
is an optional function.
Comentarios a estos manuales