New Event Handler Dialog

Applies to TestComplete 15.69, last modified on November 13, 2024

Use the New Event Handler dialog to specify a handling script routine or keyword test for an event to be handled by TestComplete. The dialog is called when you double-click an event in the Events to Handle list of the Event Control editor and no event handler is yet assigned to this event, or when you press the New button in the Event Handler cell for this event in the editor.

New Event Handler Dialog

On the left of the dialog, you can see the Test Containers tree that contains two root items -- KeywordTests and Script. Selecting the KeywordTests item, you can create a keyword test to handle an event. Child items of the Script item represent the existing script units, in which you can create a new event handling script routine.

Note: The Script item in the Test Containers tree can be collapsed or expanded. If you cannot see the Script item’s child items, simply double-click the item to expand it and view the list of the available script units.

In the dialog, you can specify either a new event handler or select an existing one. The Available Tests list on the right of the dialog displays the available event handlers (keyword tests or script routines implemented in the selected unit) that have the set of parameters required for the event to be handled. If there are no handlers with the required number of the parameters, the Available Tests list is empty and you should create a new handler.

If you want to create an event handling script routine, you can select an existing unit that will contain the routine or create a new unit. To create a new script unit, click the Script | Click here to add a new script unit item in the Test Containers tree. TestComplete invokes then the Create Project Item dialog that offers to create a new script unit in the project. In the dialog, you can specify the file name and location for the unit to be created. After TestComplete creates the new unit, its name is added to the Script branch of the Test Containers tree in the New Event Handler dialog. So, you can then select the new unit in the tree as a destination unit for the event handling script routine to be created.

To create a new event handling routine, select a unit, which should contain the routine, specify the desired routine name in the Test name edit box and press OK.

To create a new event handling keyword test, select the KeywordTests tree item, specify the test name and press OK.

Note: If you specify the name of an existing event handler that has an inappropriate number of parameters, the specified handler name will be highlighted with red in the Test name box, and the OK button will become unavailable.

By default, the Test name edit box contains the <ControlName>_<EventName> name offered by TestComplete for a new event handler. You can use this default event handler name or specify any other one in the edit box.

To close the dialog discarding any changes, click Cancel.

See Also

Handling Events - Overview

Highlight search results