Registers event handlers.


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.


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

See Also