TSelectObjectPropertyDialog Object

Applies to TestComplete 14.30, last modified on November 21, 2019

The TSelectObjectPropertyDialog component provides the Select Property wizard where testers can select a property of an object in the application under test. For example, you can use this wizard in a script extension that adds a custom property checkpoint.

TSelectObjectPropertyDialog contains a number of specific properties, methods and events that let you control various aspects of the dialog’s appearance and behavior. To display the Select Property wizard, call the Execute method. You can use the return value of this method to obtain the dialog result. To get the name of the selected onscreen object along with the name of the selected property, use the Properties property.

The example below demonstrates the use of the TSelectObjectPropertyDialog component in scripts. It requires a form named Form1 with the TcxButtonEdit component named cxButtonEdit1 and the TSelectObjectPropertyDialog component named SelectPropertyDialog1. The Form1_cxButtonEdit1_OnButtonClick routine should be assigned as an event handler for the OnButtonClick event. It displays the wizard and returns the value of the property selected in it. After that, the routine compares the return value with the expected value and posts comparison results to the log.

JavaScript, JScript

function Form1_cxButtonEdit1_OnButtonClick(Sender)
{
  var dialog = UserForms.Form1.SelectPropertyDialog1;
  if (dialog.Execute())
  {
    PropName = dialog.Properties;
    PropValue = eval(PropName);
    if (PropValue == true)
      Log.Message ("The \"" + PropValue + "\" property value equals the baseline value.");
    else
      Log.Warning ("The \"" + PropValue + "\" property value does not equal the baseline value.");
  }
}

Python

def Form1_cxButtonEdit1_OnButtonClick(Sender):
  dialog = UserForms.Form1.SelectPropertyDialog1
  if (dialog.Execute()):
    PropName = dialog.Properties
    PropValue = eval(PropName)
    if (PropValue == True):
      Log.Message ("The \"" + str(PropValue) + "\" property value equals the baseline value.")
    else:
      Log.Warning ("The \"" + str(PropValue) + "\" property value does not equal the baseline value.")

VBScript

Sub Form1_cxButtonEdit1_OnButtonClick (Sender)
  Set dialog = UserForms.Form1.SelectPropertyDialog1
  If dialog.Execute Then
    Set PropName = dialog.Properties
    Set PropValue = Eval(PropName)
    If PropValue = True Then
      Log.Message ("The """ & PropValue & """ property value equals the baseline value.")
    Else
      Log.Warning ("The """ & PropValue & """ property value does not equal the baseline value.")
    End If
  End If
End Sub

DelphiScript

procedure Form1_cxButtonEdit1_OnButtonClick(Sender: OleVariant);
var
   dialog: OleVariant;
begin
  dialog := UserForms.Form1.SelectPropertyDialog1;
   if dialog.Execute then
   begin
     PropName := dialog.Properties;
     PropValue := Evaluate(PropName);
     If PropValue = true then
       Log.Message ('The "' + PropValue + '" property value equals the baseline value.')
     else
       Log.Warning ('The "' + PropValue + '" property value does not equal the baseline value.');
   end;
end;

C++Script, C#Script

function Form1_cxButtonEdit1_OnButtonClick(Sender)
{
  var dialog = UserForms["Form1"]["SelectPropertyDialog1"];
  if (dialog["Execute"]())
  {
    var PropName = dialog["Properties"];
    var PropValule = eval(PropName);
    if (PropValue == true)
      Log["Message"] ("The \"" + PropValue + "\" property value equals the baseline value.");
    else
      Log["Warning"] ("The \"" + PropValue + "\" property value does not equal the baseline value.");
  }
}

The TSelectObjectPropertyDialog component raises a number of events that you can process in your scripts. For example, you can create an event handler for the OnShow event to perform the needed actions when the dialog is displayed.

TSelectObjectPropertyDialog Properties

TSelectObjectPropertyDialog Methods

TSelectObjectPropertyDialog Events

See Also

User Forms
Select Property Wizard
TOpenDialog Object
TSaveDialog Object
TSelectDirectory Object

Highlight search results