
143
EXTENDING DREAMWEAVER CS4
Menus and menu commands
Contents
This tag can contain one or more menuitem tags, and one or more separator tags. It can also contain other menu tags
(to create submenus) and standard HTML comment tags.
Container
This tag must be contained in a menubar tag.
Example
<menu name="_File" id="DWMenu_File">
<!-- menuitem, separator, menu, and comment tags here -->
</menu>
<menuitem>
Description
Defines a menu command for a Dreamweaver menu.
Attributes
name, id, {app}, {key}, {platform}, {enabled}, {arguments}, {command}, {file}, {checked},
{dynamic}, {isdomrequired}, {showIf}
• name The menu command name that appears in the menu. An underscore indicates that the following letter is
the command’s access key (mnemonic), for Windows only.
• id Used by Dreamweaver to identify the item. This ID must be unique throughout the menu structure. If you add
new menu commands to menus.xml, ensure uniqueness by using your company name or another unique string as
a prefix for each menu command’s ID.
• app The name of the application in which the menu command is available. Not currently used.
• key The keyboard shortcut for the command, if any. Use the following strings to specify modifier keys:
• Cmd specifies the Control key (Windows) or Command key (Macintosh).
• Alt and Opt interchangeably specify the Alt key (Windows) or Option key (Macintosh).
• Shift specifies the Shift key on both platforms.
• Ctrl specifies the Control key on both platforms.
• A Plus (+) sign separates modifier keys if a given shortcut uses more than one modifier. For example, Cmd+Opt+5
in the
key attribute means the menu command is executed when the user presses Control+Alt+5 (Windows) or
Command+Option+5 (Macintosh).
• Special keys are specified by name: F1 through F12, PgDn, PgUp, Home, End, Ins, Del, Tab, Esc, BkSp, and Space.
Modifier keys can also be applied to special keys.
• platform Indicates on which platform the item appears. Valid values are "win", meaning Windows, or "mac",
meaning Macintosh. If you don’t specify the
platform attribute, the menu command appears on both platforms.
If you want a menu command to behave differently on different platforms, supply two menu commands with the
same name (but different IDs): one with
platform="win" and the other with platform="mac".
• enabled Provides JavaScript code (usually a JavaScript function call) that determines whether the menu
command is currently enabled. If the function returns the value
false, the menu command is dimmed. The default
value is
"true", but it’s best to always specify a value for clarity even if the value is "true".
Comentários a estes Manuais