Custom Server API References > Mercury.QTP.Slv.CustomServer Namespace > IRecord Interface > Methods > RecordInit Method

Registers event handlers.

Remarks

To hook a control's events, override this method and register your event handlers in one of these ways, or a combination of them:

  • Define and add Event handlers with the IUtilityObject.AddHandler method.

    _hExpanded = new RoutedEventHandler(OnExpanded); 
    UtilityObject.AddHandler(UtilityObject.ApplicationObject as UIElement, "Expanded", hExpanded);


    There is no limit to the number of handlers defined this way.

  • Use the syntax: myApplicationObject.ValueChanged += e;

    If you use this syntax, override IRecord.RecordStop to unsubscribe from Event handling.

It is preferable to use AddHandler rather than the '+=' syntax. If you use AddHandler, UFT automatically removes your handler at the end of the Record session.

Syntax

Visual Basic (Declaration)  
Overridable Sub RecordInit() 
C#  
virtual void RecordInit()

See Also