beautypg.com

Getmenuid() – Adobe Extending Dreamweaver CS4 User Manual

Page 193

background image

187

EXTENDING DREAMWEAVER CS4

Toolbars

The name

getDynamicContent()

is a misnomer because this function should be used even if the list of entries in the

menu is fixed. For example, the Text_Size.htm file in the Configuration/Menus/MM folder is not a dynamic menu; it
is designed to be called from each one of a set of static menu items. By adding a

getDynamicContent()

function that

simply returns the list of possible font sizes, however, the same command file can also be used for a toolbar pop-up
menu. Toolbar items ignore underscores in the strings in a returned array, so you can reuse menu commands files. In
the menu commands file, Dreamweaver ignores the

getDynamicContent()

function because the menu item is not

marked as dynamic.

Arguments
None.

Returns
Dreamweaver expects an array of strings with which to populate the menu.

Example

function getDynamicContent()

{

var items = new Array;
var filename = dw.getConfigurationPath() + "/Toolbars/MM/AddressList.xml";
var location = MMNotes.localURLToFilePath(filename);
if (DWfile.exists(location))
{

var addressData = DWfile.read(location);
var addressDOM = dw.getDocumentDOM(dw.getConfigurationPath() +

'/Shared/MM/Cache/empty.htm');

addressDOM.documentElement.outerHTML = addressData;
var addressNodes = addressDOM.getElementsByTagName("url");
if (addressNodes.length)
{

for (var i=0; i < addressNodes.length ; i++ )
{

items[i] = addressNodes[i].address + ";id='" +

addressNodes[i].address + "'";

}

}

}
return items;

getMenuID()

Availability
Dreamweaver MX.

Description
Only valid for menu buttons. Dreamweaver calls the

getMenuID()

function to get the ID of the menu that should

appear when the user clicks the button.

Arguments
None.

This manual is related to the following products: