< Day Day Up > |
The following JavaScript functions let you get and set the visibility of toolbars and toolbar labels, obtain the labels of toolbar items in the current window, position toolbars, and obtain toolbar IDs. For more information on creating or modifying toolbars, see "Toolbars" in Extending Dreamweaver Help. dom.forceToolbarUpdate()Availability Dreamweaver MX 2004. Description Forces the update handlers to run for all the items on the specified toolbar. Arguments toolbarID
Returns Nothing. dom.getShowToolbarIconLabels()Availability Dreamweaver MX. Description This function determines whether labels for buttons are visible in the current document window. Dreamweaver always shows labels for non-button controls, if the labels are defined. Arguments None. Returns A Boolean value: TRue if labels for buttons are visible in the current document window; false otherwise. Example The following example makes labels for buttons visible: var dom = dw.getDocumentDom(); if (dom.getShowToolbarIconLabels() == false) { dom.setShowToolbarIconLabels(true); } dom.getToolbarIdArray()Availability Dreamweaver MX. Description This function returns an array of the IDs of all the toolbars in the application. You can use dom.getToolbarIdArray() to turn off all toolbars so you can reposition them and make only a specific set visible. Arguments None. Returns An array of all toolbar IDs. Example The following example stores the array of toolbar IDs in the tb_ids variable: var tb_ids = new Array(); tb_ids = dom.getToolbarIdArray(); dom.getToolbarItemValue()Availability Dreamweaver MX 2004. Description Gets the value of the specified toolbar item. Arguments toolbarID, itemID
Returns A string that represents the value of the toolbar item. Example The following example of receiveArguments() is in a toolbar command that controls the behavior of a Size text field; it gets the value of the Size field as an argument and then reads the value of the Units field in order to produce a valid value for the CSS property font-size function: receiveArguments(newSize){ var dom = dw.getDocumentDOM(); if (newSize != ""){ dom.applyFontMarkupAsStyle('font-size', newSize + dom.getToolbarItemValue("DW_Toolbar_Text","DW_Text_Units")); } else{ dom.removeFontMarkupAsStyle('font-size'); } } dom.getToolbarLabel()Availability Dreamweaver MX. Description This function obtains the label of the specified toolbar. You can use dom.getToolbarLabel() for menus that show or hide toolbars. Arguments toolbar_id
Returns The label name string that is assigned as an attribute on the toolbar tag. Example The following example stores the label for myEditbar in the variable label: var label = dom.getToolbarLabel("myEditbar"); dom.getToolbarVisibility()Availability Dreamweaver MX. Description This function returns a Boolean value that indicates whether the toolbar that is specified by toolbar_id is visible. Arguments toolbar_id
Returns A Boolean value: true if the toolbar is visible, false if the toolbar is not visible or does not exist. Example The following example checks whether the toolbar myEditbar is visible in the document window, and then stores that value in the retval variable: var retval = dom.getToolbarVisibility("myEditbar"); return retval; dom.setToolbarItemAttribute()Availability Dreamweaver MX 2004. Description Changes an attribute value for the three image attributes or the tooltip attribute on a toolbar item. Arguments toolbarID, toolbarItemId, attrName, attrValue
Returns Nothing. Example The following example calls dom.setToolbarItemAttribute() tHRee times to set the image, imageOver, and tooltip attributes for the toolbar item MyButton on the toolbar having the ID DW_Toolbar_Main: var dom = dw.getDocumentDOM(); dom.setToolbarItemAttribute('DW_Toolbar_Main', 'MyButton', 'image', 'Toolbars/imgs /newimage.gif'); dom.setToolbarItemAttribute('DW_Toolbar_Main', 'MyButton', 'imageOver', 'Toolbars/imgs /newimageOver.gif'); dom.setToolbarItemAttribute('DW_Toolbar_Main', 'MyButton', 'tooltip', 'One fine button'); dom.setShowToolbarIconLabels()Availability Dreamweaver MX. Description This function tells Dreamweaver to show the labels of buttons that have labels. Dreamweaver always shows labels for non-button controls, if the labels are defined. Arguments bShow
Returns Nothing. Example The following example tells Dreamweaver to show the labels for the buttons on the toolbars: dom.setShowToolbarIconLabels(true); dom.setToolbarPosition()Availability Dreamweaver MX. Description This function moves the specified toolbar to the specified position. NOTE There is no way to determine the current position of a toolbar. Arguments toobar_id, position, relative_to
Returns Nothing. Example The following example sets the position of myEditbar below the myPicturebar toolbar: dom.setToolbarPosition("myEditbar", "below", "myPicturebar"); dom.setToolbarVisibility()Availability Dreamweaver MX. Description This function shows or hides the specified toolbar. Arguments toolbar_id, bShow
Returns Nothing. Example The following example checks to see if the toolbar myEditbar is visible in the document window; if it is not visible, it sets myEditbar to be visible: var dom = dw.getDocumentDOM(); if(dom != null && dom.getToolbarVisibility("myEditbar") == false) { dom.setToolbarVisibility("myEditbar", true); { |
< Day Day Up > |