Skip to main content
All docs
V25.1
  • TdxInitializeAutomationPropertiesEvent Type

    The procedural type for UIA node property initialization events.

    Declaration

    TdxInitializeAutomationPropertiesEvent = procedure(ASender: TObject; AProperties: TdxAutomationProperties) of object;

    Parameters

    Name Type Description
    ASender TObject

    Provides access to the control/UI element that raised the UIA node property initialization event.

    Cast this parameter value to the corresponding terminal control or UI element class to access all public API members.

    Tip

    You can call the Sender.ClassType function or use any other RTTI functionality to identify the actual control or UI element type.

    AProperties TdxAutomationProperties

    Provides access to the list of initialized UIA node properties for the ASender control/UI element.

    For example, you can set the AProperties.FullDescription.Calculated property to False to disable description property calculation for the UIA tree node that corresponds to the ASender control/UI element.

    Remarks

    A UIA node property initialization event occurs in response to the first UIA property value request. If any property value of the same node changes after initialization, this event occurs again in response to the next UIA node property request.

    Code Examples

    Initialize UIA Node Properties for Editors

    The following code example initializes Name and FullDescription UIA node names for an existing single-line text editor (TcxTextEdit):

    uses
      dxUIAClasses,  // Declares all UI Automation classes
      cxEdit,  // Declares base editor classes and auxiliary types
      cxTextEdit;  // Declares the TcxTextEdit class
    // ...
    
    procedure TMyForm.cxTextEdit1PropertiesAutomationCalculateProperty(
      ASender: TObject; AProperties: TdxAutomationProperties);
    begin
      AProperties.Name.Value := 'Task Description';
      AProperties.FullDescription.Value := 'Non-Editable';
    end;
    

    Calculate Only UIA Node Names for Editors

    The code example in this section demonstrates an OnInitializeProperties event handler that disables automatic calculation for UIA node properties and enables calculation only for the Name UIA property. The form’s OnCreate event handler assigns the same OnInitializeProperties event handler to TcxTextEdit, TcxButtonEdit, and TcxCheckBox editors.

    uses
      dxUIAClasses,  // Declares all UI Automation classes
      cxEdit,  // Declares base editor classes and auxiliary types
      cxTextEdit,  // Declares the TcxTextEdit class
      cxCheckBox,  // Declares the TcxCheckBox class
      cxButtonEdit;  // Declares the TcxButtonEdit class
    // ...
    
    procedure TMyForm.InitializeAutomationProperties(
      ASender: TObject; AProperties: TdxAutomationProperties);
    begin
      if dxUIACalculateAllProperties then
        dxUIACalculateAllProperties := False;  // Disables automatic UIA node property calculation
      AProperties.Name.Calculated := True;  // Enables calculation for the initialized Name UIA property
    end;
    
    procedure TMyForm.FormCreate(Sender: TObject);
    begin
      cxTextEdit1.Properties.Automation.OnInitializeProperties := InitializeAutomationProperties;
      cxCheckBox1.Properties.Automation.OnInitializeProperties := InitializeAutomationProperties;
      cxButtonEdit1.Properties.Automation.OnInitializeProperties := InitializeAutomationProperties;
    end;
    

    Direct TdxInitializeAutomationPropertiesEvent Type Reference

    The TdxAutomationElementSettings.OnInitializeProperties event references the TdxInitializeAutomationPropertiesEvent procedural type.

    See Also