MACROMEDIA DREAMWEAVER 8-EXTENDING DREAMWEAVER Manual page 198

Extending dreamweaver
Table of Contents

Advertisement

Creating the menu commands
Add the following HTML menu tags to the end of the menus.xml file to create a menu called
MyMenu that contains the Undo and Redo menu items.
<menu name="MyMenu" id="MyMenu_Edit">
<menuitem name="MyUndo" key="Cmd+Z" file="Menus/MyMenu.htm"
arguments="'undo'" id="MyMenu_Edit_Undo" />
<menuitem name="MyRedo" key="Cmd+Y" file="Menus/MyMenu.htm"
arguments="'redo'" id="MyMenu_Edit_Redo" />
</menu>
The
attribute defines keyboard shortcut keys that the user can type to invoke the menu
key
item. The
attribute specifies the name of the command file that Dreamweaver executes
file
when Dreamweaver invokes the menu item. The value of the
arguments that Dreamweaver will pass when it calls the
The following figure shows these menu items:
Writing the JavaScript code
When the user selects either Undo or Redo on the MyMenu menu, Dreamweaver calls the
MyMenu.htm command file, which is specified by the
Create the MyMenu.htm command file in the Dreamweaver Configuration/Menus folder
and add the three menu command API functions,
receiveArguments()
Undo and Redo menu items
canAcceptCommand()
Dreamweaver calls the
menu to determine whether it should be enabled or disabled. In the MyMenu.htm file, the
canAcceptCommand()
Dreamweaver is processing a Redo menu item or an Undo menu item. If the argument is
, the
"undo"
canAcceptCommand()
returns the returned value, which is either
, the
"redo"
canAcceptCommand()
returns its value to Dreamweaver. If the
, Dreamweaver dims the menu item for which it called the function. The following
false
example shows the code for the
198
Menus and Menu Commands
, and
setMenuText()
The following sections describe these functions.
.
canAcceptCommand()
function checks the value of
function calls the enabler function
true
function calls the enabler function
canAcceptCommand()
canAcceptCommand()
arguments
receiveArguments()
attribute of the
file
canAcceptCommand()
, to implement the logic associated with the
function for each menu item in the MyMenu
arguments[0]
or
. Likewise, if the argument is
false
function returns the value
function:
attribute defines the
function.
tag.
menuitem
,
to determine whether
and
dw.canUndo()
and
dw.canRedo()

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Dreamweaver 8

Table of Contents