Specifications
51
CHAPTER 5
Objects
Objects are designed to insert a specific string of code into a user’s document. An object appears
in a tab in the Insert bar and in the Insert menu when its Object file is stored in a subfolder
within the Configuration/Objects folder. If you add a new object to the Insert bar, you must add
a new subfolder for it within the Configuration/Objects folder and also edit the insertbar.xml file.
Objects have three components: the Object file that defines what is inserted in your document,
the 18 x 18 pixel image that appears on the Insert bar, and the insertbar.xml file that defines
where the object appears on the Insert bar.
Objects are HTML files. The
BODY of an Object file can contain an HTML form that accepts
parameters for the object (for example, the number of rows and columns to insert in a table). The
HEAD of an Object file contains JavaScript functions that process form input from the BODY and
control what is added to the user’s document.
Note: The simplest objects contain only the HTML to insert, without a BODY and HEAD tag. See “Customizing
Dreamweaver” on the Macromedia Support Center for more information.
How object files work
When a user selects an object by clicking an icon in the Insert bar or by selecting an item in the
Insert menu, the following events occur:
1 Dreamweaver calls the canInsertObject() function to determine whether to show a dialog box.
2 The Object file is scanned for a FORM tag. If a form exists and if the Show Dialog When
Inserting Objects option is selected in the General preferences, Dreamweaver calls the
windowDimensions() function, if defined, to determine the size of the dialog box in which to
display the form. If no form exists in the Object file, Dreamweaver does not display a dialog
box, and skips step 2.
3 If Dreamweaver displays a dialog box in step 1, the user enters parameters for the object (such
as the number of rows and columns in a table) in the dialog box and clicks OK.
4 The objectTag() function is called, and its return value is inserted into the document after
the current selection (it does not replace the current selection).
5 If Dreamweaver does not find the objectTag() function, it looks for an insertObject()
function and calls that function instead.