HD$ AddCustomToolbarButton Method |
This function adds a button to the interview toolbar. When a user clicks the button, a JavaScript function is called that performs any action you may wish to make available to users of your host application, such as displaying your host application's help file. (To avoid ambiguity, you should use a full URL for all image file parameters passed to this function.)
JavaScript API: Embedded
Assembly: hotdocs.js Version: 1.0.0.0 (1.0.0.0)
Syntax
JavaScript
function AddCustomToolbarButton(funcClick, imageNormal, imageHot, statusText, tooltip, funcActive, imageActive, imageActiveHot, tooltipActive, buttonIndex, textOnlyCaption, callback);
Parameters
- funcClick
- Type: function
A Javascript function that should be called whenever the button is clicked. It should accept one parameter, which is the ID for the toolbar button being clicked. - imageNormal
- Type: System
String
This is the URL for the button's "normal" image. - imageHot
- Type: System
String
This is the URL for the image displayed when the mouse is hovered over the button. - statusText
- Type: System
String
This is the text that is displayed in the status bar when the mouse is hovered over the button. - tooltip
- Type: System
String
This is the text that is displayed as a hint when the mouse is hovered over the button. - funcActive
- Type: function
A Javascript function that should be called to determine if the button is active or not. It should accept one parameter, which is the ID for the toolbar button being checked. - imageActive
- Type: System
String
This is the image for the button when it is active. - imageActiveHot
- Type: System
String
This is the image for the button when it is active and the mouse is hovered over it. - tooltipActive
- Type: System
String
This is the text that is displayed as a hint when the button is active and the mouse is hovered over it. - buttonIndex
- Type: System
Int32
This is the location of the button within the group of toolbar buttons. (Default: 0, which means the button will be placed in the first (left-most) position in the group) - textOnlyCaption
- Type: System
String
The caption to display on a text-only button. - callback
- Type: function
A function to which a button ID for the custom button will be passed. You can later use this button ID invoke the button programmatically or to set the button's visibility.
Remarks
To use this function, place a call to AddCustomToolbarButton inside of your HDInterviewOptions.OnInit method.
The first two parameters are required; the rest are optional.
Custom buttons are always added to the left of the existing toolbar buttons in the order in which they are added.
You can also add custom buttons to the toolbar on the server side using the COM or .NET API, although buttons added on the server side cannot have active and inactive states. (They are always active.)
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.
Examples
JavaScript
var MyButtonIsActive = true; function ActiveButton() { return MyButtonIsActive; } function HelloWorld() { MyButtonIsActive = !MyButtonIsActive; } HDInterviewOptions.OnInit = function () { HD$.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" ); }
See Also