User Guide
379
CHAPTER 18
Code
The Code functions let you perform operations on a document that appears in Code view. These
operations include adding new menu or function tags to a Code Hints menu, finding and
replacing string patterns, deleting the current selection from a document, printing all or selected
code, editing tags, or applying syntax formatting to selected code.
Code functions
Code Hints are menus that Macromedia Dreamweaver MX 2004 opens when you type certain
character patterns in Code view. Code Hints provide a typing shortcut by offering a list of strings
that potentially complete the string you are typing. If the string you are typing appears in the
menu, you can scroll to it and press Enter or Return to complete your entry. For example, when
you type <, a pop-up menu shows a list of tag names. Instead of typing the rest of the tag name,
you can select the tag from the menu to include it in your text.
You can add Code Hints menus to Dreamweaver by defining them in the CodeHints.xml file. For
information on the CodeHints.xml file, see Extending Dreamweaver.
You can also add new Code Hints menus dynamically through JavaScript after Dreamweaver
loads the contents of the CodeHints.xml file. For example, JavaScript code populates the list of
session variables in the Bindings panel. You can use the same code to add a Code Hints menu, so
when a user types Session in Code view, Dreamweaver displays a menu of session variables.
The CodeHints.xml file and the JavaScript API expose a useful subset of the Code Hints engine,
but some Dreamweaver functionality is not accessible. For example, there is no JavaScript hook to
open a color picker, so Dreamweaver cannot express the Attribute Values menu using JavaScript.
You can only open a menu of text items from which you can insert text.
Code Coloring lets you specify code color styles and to modify existing code coloring schemes or
create new ones. You can specify code coloring styles and schemes by modifying the Colors.xml
and code coloring scheme files. For more information on these files, see Extending Dreamweaver.
The JavaScript API for Code Hints and Code Coloring consists of the following functions.
000_DW_API_Print.book Page 379 Wednesday, August 20, 2003 9:14 AM