aqObject.GetEvents Method

Applies to TestComplete 14.71, last modified on April 22, 2021

Description

The GetEvents property returns an aqObjIterator object that lists all the events of the desired object. Use the aqObjIterator.HasNext, aqObjIterator.Next and aqObjIterator.Item methods of the returned aqObjIterator object to iterate through the collection of the object’s events. Each single event is described by an individual aqObjEvent object.

Declaration

aqObject.GetEvents(SourceObjectShowHidden)

SourceObject [in]    Required    Object    
ShowHidden [in]    Optional    Boolean Default value: False   
Result The aqObjIterator object.

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

SourceObject

The object whose events you want to retrieve. If the specified object was not found, the GetEvents method returns an empty value (that is, Nothing in VBScript, null in JavaScript, JScript, C++Script and C#Script, None in Python and nil in DelphiScript).

ShowHidden

Specifies whether to retrieve hidden events of the object. Hidden events are those that are displayed in the Object Browser but are not listed in the Code Completion window.

Result Value

The aqObjIterator object whose items are aqObjEvent objects that correspond to the events of the source object.

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

GetProperties Method
GetMethods Method
GetFields Method
aqObjIterator Object

Highlight search results