Back to Devexpress

dxUIACalculateAllProperties Variable

vcl-dxuiaclasses-73d37f95.md

latest4.6 KB
Original Source

dxUIACalculateAllProperties Variable

Specifies if all properties are automatically calculated for a node in the UI Automation tree.

Declaration

delphi
var dxUIACalculateAllProperties: Boolean = True;

Variable Value

TypeDescription
BooleanTrue Recommended. All UIA node properties are calculated automatically.False

Automatic UIA node property calculation is disabled. In this mode, you can define individual UI node properties as calculated in Automation.OnInitializeProperties event handlers for each target control.

Note

This option may be useful in certain cases when the UI Automation functionality reduces application UI responsiveness.

|

Remarks

You can set the dxUIACalculateAllProperties global variable to False if you need to disable automatic property calculation for UIA nodes associated with all supported DevExpress controls in an application.

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.

delphi
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;
cpp
#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;
}

See Also

dxUIAutomationEnabled Global Variable

dxUIAClasses Unit