How menu commands work
When the user clicks a menu with a menu item that contains a menu command, the following events occur:
- If any
menuitemtag in the menu contains thedynamicattribute, Adobe Dreamweaver calls thegetDynamicContent()function in the associated Menu Commands file to populate the menu. - Adobe Dreamweaver calls the
canAcceptCommand()function in each Menu Commands file that is referenced in the menu to check whether the command is appropriate for the selection.- If the
canAcceptCommand()function returns afalsevalue, the menu item is dimmed. - If the
canAcceptCommand()function returns atruevalue or is not defined, Adobe Dreamweaver calls theisCommandChecked()function to determine whether to display a check mark next to the menu item. If theisCommandChecked()function is not defined, no check mark appears.
- If the
- Adobe Dreamweaver calls the
setMenuText()function to determine the text that should appear in the menu.If the
setMenuText()function is not defined, Adobe Dreamweaver uses the text that is specified in themenuitemtag. - The user selects an item from the menu.
- Adobe Dreamweaver calls the
receiveArguments()function, if defined, in the selected Menu Commands file to let the command process any arguments that pass from the menu item.NOTE
If it is a dynamic menu item, the ID of the menu item passes as the only argument.
- Adobe Dreamweaver calls the
commandButtons()function, if defined, to determine which buttons appear on the right side of the Options dialog box and what code should execute when the user clicks the buttons. - Adobe Dreamweaver scans the Menu Commands file for a
FORMtag.If a form exists, Adobe Dreamweaver calls the
windowDimensions()function to determine the size of the Options dialog box that contains theBODYelements of the file.If the
windowDimensions()function is not defined, Adobe Dreamweaver automatically sizes the dialog box. - If the Menu Commands file's
BODYtag contains anonLoadhandler, Adobe Dreamweaver executes the associated code (whether or not a dialog box appears). If no dialog box appears, the remaining steps do not occur. - The user selects options in the dialog box. Adobe Dreamweaver executes event handlers that are associated with the fields as the user encounters them.
- The user clicks one of the buttons that are defined by the
commandButtons()function. - Adobe Dreamweaver executes the code that is associated with the clicked button.
- The dialog box remains visible until one of the scripts in the Menu Commands file calls the
window.close()function.