CLXObject Method

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

Description

Use this method to obtain a scripting interface to the specified object of an Open Application that was created in Delphi or C++Builder using CLX classes. The resulting object contains both CLX and TestComplete methods, properties, events and actions.

Declaration

TestObj.CLXObject(Name)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Name [in]    Required    String    
Result Object

Applies To

The method is applied to the following objects:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameter:

Name

The name of the desired object. This can be the object’s name as it is specified in the tested application’s source code (the string that is returned by the object’s “native” Name property) or the name generated by TestComplete (when the “native” Name property is empty). TestComplete generates the name using the object’s class name (for example, TEdit) and an index. To learn the generated name, explore your application in the Object Browser.

Result Value

The CLXObject method returns an object that provides a scripting interface to an object located in an Open Application that was created in Delphi or C++Builder using CLX classes. If TestComplete cannot access the specified object (for example, this object does not exist), the method will return an empty stub object. To determine whether CLXObject returns a valid object, use the Exists property of the resultant object. If this property returns False, then the returned object is a stub object and the call to CLXObject was not successful.

Remarks

The returned object contains both methods and properties defined in the application code as well as methods, properties and actions provided by TestComplete. The returned object may hold two or more methods and properties having the same name. When you call this type of method or property, a naming conflict will occur. To avoid it and to specify which method or property is to be called, use the NativeDelphiObject namespace.

The method is available only if the Delphi and C++Builder Application Support plugin is installed and enabled in TestComplete. Otherwise, the method is absent in the method list of the TestObj object.

If the plugin is installed, you cannot use the Window method to address CLX objects in Delphi and C++Builder applications; you should use the CLXObject method instead.

Some CLX controls (for example, TMainMenu and TPopupMenu instances) are accessed via the VCLObject and/or WaitVCLObject methods. This is because their CLX and VCL versions are implemented similarly and TestComplete can not distinguish them. In this case a good solution is to explore the CLX application in the Object Browser or use the Find, FindChild and FindId methods.

Example

To view an example that demonstrates how to use the CLXObject method, see Addressing Objects in C++Builder Applications.

See Also

Addressing Objects in Delphi Applications
Addressing Objects in C++Builder Applications
Object Browser Naming Notation
Using Namespaces
About Open Applications
WaitCLXObject Method
Window Method
WaitWindow Method

Highlight search results