beautypg.com

Create the image, Test the property inspector, The property inspector api functions – Adobe Extending Dreamweaver CS4 User Manual

Page 225: Caninspectselection()

background image

219

EXTENDING DREAMWEAVER CS4

Property inspectors

Create the image

You can optionally create the image that appears in the Property inspector.

1

Create an image that is 36 pixels wide and 36 pixels high.

2

Save the image as marquee.gif in Configuration/Inspectors.

In general, you can save images for Property inspectors in any format that Dreamweaver supports.

Test the Property inspector

Finally, you can test the Property inspector.

1

Restart Dreamweaver.

2

Create a new HTML page, or open an existing HTML page.

3

Add the following in the body section of the page:

4

Highlight the text you just added.

The Property inspector you created for the

marquee

tag appears.

5

Enter a value for the direction attribute in the Property inspector.

The tag on your page changes to include the direction attribute and the value you entered in the Property inspector.

The Property inspector API functions

Two of the Property inspector API functions (

canInspectSelection()

and

inspectSelection()

) are required.

canInspectSelection()

Description
Determines whether the Property inspector is appropriate for the current selection.

Arguments
None.

Note: Use

dom.getSelectedNode()

to get the current selection as a JavaScript object (for more information about

dom.getSelectedNode()

, see the Dreamweaver API Reference).

Returns
Dreamweaver expects a Boolean value:

true

if the inspector can inspect the current selection;

false

otherwise.

Example
The following instance of the

canInspectSelection()

function returns a

true

value if the selection contains the

CLASSID

attribute, and the value of that attribute is

"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

(the class

ID for Adobe Flash Player):

This manual is related to the following products: