aqObjEvent Object

Applies to TestComplete 15.44, last modified on November 10, 2022

Description

The aqObjEvent object provides a scripting interface to object events that you can see on the Events page of the Object Browser panel. To obtain the aqObjEvent object in scripts, use the GetEvents method of the aqObject object.

Note: Actually, the GetEvents method returns the aqObjIterator object that stores information about all found object events. To get information about a single event, you can use the aqObjIterator.Item and aqObjIterator.Next methods.

Members

Example

The code below obtains the events collection that belongs to the specified object and posts the names of the events to the test log.

JavaScript, JScript

function GettingEvents()
{

  var Obj = Sys.Process("MyApplication");
  
  // Obtains the events collection
  var EventsCol = aqObject.GetEvents(Obj);
  
  Log.Message("The events are:");
  
  // Posts the events names to the test log
  while ( EventsCol.HasNext() )
    Log.Message(EventsCol.Next().Name);
  
}

Python

def GettingEvents():
  Obj = Sys.Process("MyApplication")
  # Obtains the events collection
  EventsCol = aqObject.GetEvents(Obj)
  Log.Message("The events are:")
  # Posts the events names to the test log 
  while EventsCol.HasNext():
    Log.Message(EventsCol.Next().Name)

VBScript

Sub GettingEvents

  Set Obj = Sys.Process("MyApplication")
  
  ' Obtains the events collection
  Set EventsCol = aqObject.GetEvents(Obj)
  
  Log.Message "The events are:"
  
  ' Posts the events names to the test log
  While EventsCol.HasNext
    Log.Message EventsCol.Next.Name
  WEnd
  
End Sub

DelphiScript

function GettingEvents;
var Obj, EventsCol;
begin

  Obj := Sys.Process('MyApplication');
  
  // Obtains the events collection
  EventsCol := aqObject.GetEvents(Obj);
  
  Log.Message('The events are:');
  
  // Posts the events names to the test log
  while ( EventsCol.HasNext() ) do
    Log.Message(EventsCol.Next().Name);
  
end;

C++Script, C#Script

function GettingEvents()
{

  var Obj = Sys["Process"]("MyApplication");
  
  // Obtains the events collection
  var EventsCol = aqObject["GetEvents"](Obj);
  
  Log["Message"]("The events are:");
  
  // Posts the events names to the test log
  while ( EventsCol["HasNext"]() )
    Log["Message"](EventsCol["Next"]()["Name"]);
  
}

See Also

aqObjIterator Object

Highlight search results