New Event Handler Dialog (User Forms)

Applies to TestComplete 15.47, last modified on January 20, 2023

Use the New Event Handler dialog to specify a handling script routine for an event to be handled by TestComplete. The dialog is called after you click the ellipsis button on the right of the needed event in the User Forms editor.

New Event Handler Dialog

On the left of the dialog, you can see the Test Containers tree containing the Script root item. Child items of the Script item represent 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 (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.

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 <UserFormName>_<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

Highlight search results