< Day Day Up > |
Code Hints are menus that Macromedia Dreamweaver 8 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. dreamweaver.codeHints.addMenu()Availability Dreamweaver MX. Description Dynamically defines a new menu tag in the CodeHints.xml file. If there is an existing menu tag that has the same pattern and document type, this function adds items to the existing menu. Arguments menuGroupId, pattern, labelArray, {valueArray}, {iconArray}, {doctypes}, {casesensitive}
Returns Nothing. Example If the user creates a record set called "myRs", the following code would create a menu for myRS: dw.codeHints.addMenu( "CodeHints_object_methods", // menu is enabled if object methods are enabled "myRS.", // pop up menu if user types "myRS." new Array("firstName", "lastName"), // items in drop-down menu for myRS new Array("firstName", "lastName"), // text to actually insert in document null, // no icons for this menu "ASP_VB, ASP_JS"); // specific to the ASP doc types dreamweaver.codeHints.addFunction()Availability Dreamweaver MX. Description Dynamically defines a new function tag. If there is an existing function tag with the same pattern and document type, this function replaces the existing function tag. Arguments menuGroupId, pattern, {doctypes}, {casesensitive}
Returns Nothing. Example The following example of the dw.codeHints.addFunction() function adds the function name pattern out.newLine() to the Code Hints menu group CodeHints_Object_Methods and makes it active only for JSP document types: dw.codeHints.addFunction( "CodeHints_Object_Methods", "out.newLine()", "JSP") dreamweaver.codeHints.resetMenu()Availability Dreamweaver MX. Description Resets the specified menu tag or function tag to its state immediately after Dreamweaver reads the CodeHints.xml file. In other words, a call to this function erases the effect of previous calls to the addMenu() and addFunction() functions. Arguments menuGroupId, pattern, {doctypes}
Returns Nothing. Example Your JavaScript code might build a Code Hints menu that contains user-defined session variables. Each time the list of session variables changes, that code needs to update the menu. Before the code can load the new list of session variables into the menu, it needs to remove the old list. Calling this function removes the old session variables. dreamweaver.codeHints.showCodeHints()Availability Dreamweaver MX. Description Dreamweaver calls this function when the user opens the Edit > Show Code Hints menu item. The function opens the Code Hints menu at the current selection location in Code view. Arguments None. Returns Nothing. Example The following example opens the Code Hints menu at the current insertion point in the document when it is in Code view. dw.codeHints.showCodeHints() dreamweaver.reloadCodeColoring()Description Reloads code coloring files from the Dreamweaver Configuration/Code Coloring folder. Arguments None. Returns Nothing. Example dreamweaver.reloadCodeColoring() |
< Day Day Up > |