beautypg.com

Documentedited(), Getdockingside() – Adobe Extending Dreamweaver CS4 User Manual

Page 234

background image

228

EXTENDING DREAMWEAVER CS4

Floating panels

Example

// the following instance of displayHelp() opens

// in a browser a file that explains how to use
// the extension.
function displayHelp(){

var myHelpFile = dw.getConfigurationPath() +

'/ExtensionsHelp/superDuperHelp.htm';

dw.browseDocument(myHelpFile);

}

documentEdited()

Description
This function is called when the floating panel becomes visible and after the current series of edits is complete; that is,
multiple edits might occur before this function is called. This function should be defined only if the floating panel must
track edits to the document.

Note: Define the

documentEdited()

function only if you require it because its existence impacts performance.

Arguments
None.

Returns
Dreamweaver expects nothing.

Example
The following example of the

documentEdited()

function scans the document for AP elements and updates a text

field that displays the number of AP elements in the document:

function documentEdited(){

/* create a list of all the AP elements in the document */
var theDOM = dw.getDocumentDOM();
var layersInDoc = theDOM.getElementsByTagName("layer");
var layerCount = layersInDoc.length;

/* update the numOfLayers field with the new layercount */
document.theForm.numOfLayers.value = layerCount;

}

getDockingSide()

Availability
Dreamweaver MX.

Description
Specifies the locations at which a floating panel can dock. The function returns a string that contains some
combination of the words "

left

", "

right

", "

top

", and "

bottom

". If the label is in the string, you can dock a floating

panel to that side. If the function is missing, you cannot dock a floating panel to any side.

You can use this function to prevent certain panels from docking on a certain side of the Dreamweaver workspace or
to each other.

This manual is related to the following products: