windowHDAddCustomToolbarButton Method |
JavaScript API: Direct
Assembly: api.js Version: 1.0.0.0 (1.0.0.0)
function HDAddCustomToolbarButton(funcClick, imageNormal, imageHot, statusText, tooltip, funcActive, imageActive, imageActiveHot, tooltipActive, buttonIndex, textOnlyCaption);
Parameters
- funcClick
- Type: function
A Javascript function that should be called whenever the button is clicked. This function should accept one parameter, which is the ID for the toolbar button being clicked. - imageNormal
- Type: string
This is the URL for the button's "normal" image. To create a text-only button, set this parameter to null. - imageHot
- Type: string
This is the URL for the image displayed when the mouse is hovered over the button. - statusText
- Type: string
This is the text that is displayed in the browser status bar when the mouse is hovered over the button. - tooltip
- Type: string
This is the text that is displayed as a hint (tool tip/alternate text) for the button. - funcActive
- Type: function
A Javascript function that should be called to determine if the button should be in an "active" state or not. It should accept one parameter (the ID for the toolbar button being checked) and should return a boolean value. - imageActive
- Type: string
This is the image for the button when it is in an "active" state. - imageActiveHot
- Type: string
This is the image for the button when it is both in an "active" and the mouse is hovered over it. - tooltipActive
- Type: string
This is the text that is displayed as a hint (tool tip/alternate text) when the button is in an "active" state. - buttonIndex
- Type: number
This is the location of the button within its group of toolbar buttons. (Default: 0, which means the button will be placed in the first (left-most) position in the group) - textOnlyCaption
- Type: string
The caption to use for a button that should be displayed as text-only (no image).
Return Value
Type: stringThis function returns a button ID, which you can later use to invoke the button programmatically or to set the button's visibility.
The first two parameters are required; the rest are optional.
Buttons can be simple command buttons or toggle buttons. A toggle button is one that has two states (normal and "active"), and represents a mode that can be toggled on or off by the user. For example, the built-in button for showing & hiding the resource pane in the interview is a toggle button -- the resource pane can be shown (the button is in the "active" state) or hidden (the button is in the "normal" state). For simple command buttons that do not have an "on" or "off" state, all the parameters with "Active" in the name can simply be omitted or set to null.
Custom buttons are always added to the left of the existing toolbar buttons in the order in which they are added.
To avoid ambiguity, you should use a full URL for all image file parameters passed to this function.
Silverlight interviews support only .PNG and .JPG images. If you intend to use the Silverlight interview format, make sure to use a supported image type.
var MyButtonIsActive = true; function ActiveButton() { return MyButtonIsActive; } function HelloWorld() { MyButtonIsActive = !MyButtonIsActive; } var HDInterviewOptions = { OnInit: function() { HDAPI.AddCustomToolbarButton( HelloWorld, "http://servername/images/btn.png", "http://servername/images/btnhot.png", "Status Message", "Tooltip", ActiveButton, "http://servername/images/btnActive.png", "http://servername/images/btnActiveHot.png", "Active Tooltip"); } };