Chapter 5. Creating Custom Commands and Menu Commands


Commands are the things we choose from menus . Unlike objects and behaviors, which are limited to performing the specific tasks of adding HTML and JavaScript code to user documents, commands can be used for almost any editing taskinserting code, removing code, editing code, even opening and closing documents, connecting to servers, and launching external applications.

The Dreamweaver Application Programming Interface (API) includes two kinds of commands: regular commands and menu commands. The difference between them is subtle and doesn't involve the functionality of what they can do, but of how and where they appear in the Dreamweaver menu system. Regular commands appear in the Commands menu by default, although this default can be overridden by editing the menus.xml file. The menu items representing regular commands are static, meaning that the name and appearance of the menu item does not change based on document context or other conditions.

Figure 5.1 shows some regular commands as they appear in the Commands menu. Menu commands don't appear in the menu system at all by default; their presence in the menu system is determined solely by menus.xml. In addition to this, menu commands have the ability to generate dynamic menu itemsfor instance, the menu item can include a toggling checkmark as a program feature is turned on or off, or the item name might read differently depending on what documents are open or what page elements are selected. Figure 5.2 shows a selection of dynamically generated menu commands in various menus.

Figure 5.1. The Commands menu, showing entries for regular commands.

graphics/05fig01.gif

Figure 5.2. The Window and Edit menus, showing dynamic menu entries generated from menu commands.

graphics/05fig02.gif

In this chapter, we'll start by familiarizing ourselves with the API for regular commands; then we'll examine the added functionality of menu commands.



Dreamweaver MX Extensions
Dreamweaver MX Extensions
ISBN: 0735711828
EAN: 2147483647
Year: 2001
Pages: 141
Authors: Laura Gutman

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net