Placing The Command File In The Menu Folder; A Dynamic Menu; Creating The Dynamic Menu Items - MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Manual

Extending dreamweaver
Hide thumbs Also See for DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER:
Table of Contents

Advertisement

Placing the command file in the Menu folder

To implement the menu Undo and Redo menu items, you must save the MyMenu.htm
command file in the Dreamweaver Configuration/Menus folder or a subfolder that you create.
The location of the file must agree with the location that you specified on the
make it accessible to Dreamweaver, either restart Dreamweaver or reload extensions. For
information on how to reload extensions, see
To run the menu commands, select the menu item when it is enabled. Dreamweaver will invoke
the functions in the command file, as described in

A dynamic menu

This example implements the Dreamweaver Preview in Browser submenu that displays a list of
available browsers. The example also opens the current file, or the selected files in the Site panel,
in the user-specified browser. Implementing this dynamic menu consists of the following steps:

Creating the dynamic menu items

1
Writing the JavaScript code
2
Creating the dynamic menu items
The following menu tags in the menus.xml file define the Preview in Browser submenu of the
File menu:
<menu name="_Preview in Browser" id="DWMenu_File_PIB">
<menuitem dynamic name="No Browsers Selected"
file="Menus/MM/PIB_Dynamic.htm" arguments="'No Browsers'"
id="DWMenu_File_PIB_Default" />
<separator />
<menuitem name="_Edit Browser List..." enabled="true"
command="dw.editBrowserList()" id="DWMenu_File_PIB_EditBrowserList" />
</menu>
The first
menuitem
the submenu if you have not specified any browsers for the Preview in Browser item in
Preferences. If you specified the Internet Explorer browser, however, the submenu would look like
the following figure:
The
attribute for the first menu item specifies the command file PIB_Dynamic.htm. This
name
file contains the following line:
<SCRIPT LANGUAGE="javascript" SRC="PIB_Dynamic.js"></SCRIPT>
The
tag includes the JavaScript code in the PIB_Dynamic.js file, which supplies the
script
JavaScript code that interacts with the Preview in Browser submenu. This code could be saved
directly in the PIB_Dynamic.htm file, but storing it in a separate file allows multiple commands
to include the same code.
164
Chapter 8: Menus and Menu Commands
tag defines the default menu item
"Running the command" on page
"How menu commands work" on page
No Browsers Selected
tag. To
menuitem
144.
155.
, which appears on

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Dreamweaver mx 2004

Table of Contents