Adding a Button to a Toolbar

You can use the Toolbar Button Editor to define a toolbar button to be displayed on the window of an ALM module, or on the Manual Runner dialog box.

To add a button to a toolbar:

  1. In the Script Editor, click the Toolbar Button Editor tab.

  2. From the Command bar list, select the toolbar to which you want to add a button:


    Toolbar Location


    Requirements module window.


    Test Plan module window.


    Test Lab module window.


    Manual Runner dialog box.


    Defects module window.


    Business Components module window. This option depends on your ALM license.


    Releases module window.


    Test Resources module window.


    Analysis module window.


    Dashboard module window.


    Business Models module window.


    Libraries module window.


    Test Runs module window.

  3. Click Add. A default command name for the button is added to the Commands list.

  4. In the Caption box, type a new command name for the button, or use the default name.

  5. In the Hint box, type a tooltip for the button.

  6. In the Action Name box, type a new action name for the button, or use the default name.

  7. Under Images, select an icon for the button.

  8. Click Apply to apply your changes.

  9. To delete a button that you have created, select its command name in the Commands list, and click Remove.

  10. Click the Save button to save the new button definition.

  11. Click the Script Editor tab.

  12. In the Scripts Tree of the Script Editor, select the ActionCanExecute event procedure located in the common script section.

  13. In the procedure displayed in the scripts pane of the Script Editor, add statements to be performed if the user initiates an action with the action name you defined for the button. Set the return value to True or False.

    For example, the following code opens a message box when the user clicks the Requirements_Action1 button on the tool bar of the Requirements module:

    Function ActionCanExecute(ActionName)
        On Error Resume Next
        ActionCanExecute = True
            If ActionName = "UserDefinedActions.Requirements_Action1" Then
                MsgBox "You clicked the Action1 button." 
            End If
        On Error GoTo 0
    End Function

    For details, see Example: Adding Button Functionality.

  14. Click the Save button to save the script.