vcl-dxuiaclasses-bfce66dc.md
The procedural type for UIA node property initialization events.
TdxInitializeAutomationPropertiesEvent = procedure(ASender: TObject; AProperties: TdxAutomationProperties) of object;
| 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.
|
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.
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;
#include "dxUIAClasses.hpp" // Declares all UI Automation classes
#include "cxEdit.hpp" // Declares base editor classes and auxiliary types
#include "cxTextEdit.hpp" // Declares the TcxTextEdit class
// Add the following linker directives to the corresponding CPP source file:
#pragma link "dxUIAClasses" // Required to use dxUIAClasses.hpp declarations
#pragma link "cxTextEdit" // Required to use cxTextEdit.hpp declarations
#pragma link "cxEdit" // Required to use cxEdit.hpp declarations
void __fastcall TMyForm::cxTextEdit1PropertiesAutomationCalculateProperty(
TObject *ASender, TdxAutomationProperties *AProperties)
{
AProperties->Name->Value = "Task Description";
AProperties->FullDescription->Value = "Non-Editable";
}
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;
#include "dxUIAClasses.hpp" // Declares all UI Automation classes
#include "cxEdit.hpp" // Declares base editor classes and auxiliary types
#include "cxTextEdit.hpp" // Declares the TcxTextEdit class
#include "cxCheckBox.hpp" // Declares the TcxCheckBox class
#include "cxButtonEdit.hpp" // Declares the TcxButtonEdit class
// Add the following linker directives to the corresponding CPP source file:
#pragma link "dxUIAClasses" // Required to use dxUIAClasses.hpp declarations
#pragma link "cxTextEdit" // Required to use cxTextEdit.hpp declarations
#pragma link "cxEdit" // Required to use cxEdit.hpp declarations
#pragma link "cxCheckBox" // Required to use cxCheckBox.hpp declarations
#pragma link "cxButtonEdit" // Required to use cxButtonEdit.hpp declarations
void __fastcall TMyForm::InitialieAutomationProperties(
TObject *ASender, TdxAutomationProperties *AProperties)
{
if(dxUIACalculateAllProperties)
dxUIACalculateAllProperties = false; // Disables automatic UIA node property calculation
AProperties->Name->Calculated = true; // Enables calculation for the initialized Name UIA property
}
void __fastcall TMyForm::FormCreate(TObject *Sender)
{
cxTextEdit1->Properties->Automation->OnInitializeProperties = InitializeAutomationProperties;
cxCheckBox1->Properties->Automation->OnInitializeProperties = InitializeAutomationProperties;
cxButtonEdit->Properties->Automation->OnInitializeProperties = InitializeAutomationProperties;
}
The TdxAutomationElementSettings.OnInitializeProperties event references the TdxInitializeAutomationPropertiesEvent procedural type.
See Also
TdxCalculateAutomationPropertyEvent Procedural Type
TdxGridInitializeRowAutomationPropertiesEvent Procedural Type