Back to Devexpress

TdxCalculateAutomationPropertyEvent Type

vcl-dxuiaclasses-d2d3394e.md

latest4.6 KB
Original Source

TdxCalculateAutomationPropertyEvent Type

The procedural type for UIA node property calculation events.

Declaration

delphi
TdxCalculateAutomationPropertyEvent = procedure(ASender: TObject; AProperty: TdxAutomationProperty; AProperties: TdxAutomationProperties) of object;

Parameters

NameTypeDescription
ASenderTObject

Provides access to the control/UI element that raised the UIA node property calculation 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.

| | AProperty | TdxAutomationProperty |

Provides access to the currently calculated UIA node property.

Cast this parameter value to the corresponding terminal UIA node property class (TdxStringAutomationProperty, for example) to access all public API members.

Tip

You can call the AProperty.ClassType function or use any other RTTI functionality to identify the actual UIA property type.

| | AProperties | TdxAutomationProperties |

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

|

Remarks

UIA node property calculation events occur every time a UIA client requests individual node properties (multiple times – once per node property).

Code Example: Indicate Read-Only and Editable States

The code example in this section changes the description of an unbound single-line text editor (TcxTextEdit) in the UI Automation tree when the editor switches between read-only and editable states.

delphi
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; AProperty: TdxAutomationProperty;
  AProperties: TdxAutomationProperties);
var
  AEdit: TcxTextEdit;
begin
  AEdit := ASender as TcxTextEdit;
  // Check if the UIA node description property is requested
  if AProperty = AProperties.FullDescription then
  begin
    if AEdit.Properties.ReadOnly then
      AProperties.FullDescription.Value := 'Read-Only Mode'
    else
      AProperties.FullDescription.Value := 'Editable';
  end;
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

// 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, TdxAutomationProperty *AProperty,
  TdxAutomationProperties *AProperties)
{
  TcxTextEdit *AEdit = dynamic_cast<TcxTextEdit*>(ASender);
  // Check if the UIA node description property is requested
  if(AProperty == AProperties->FullDescription)
  {
    if(AEdit->Properties->ReadOnly)
      AProperties->FullDescription->Value = "Read-Only Mode";
    else
      AProperties->FullDescription->Value = "Editable";
  }
}

Direct TdxCalculateAutomationPropertyEvent Type Reference

The TdxAutomationElementSettings.OnCalculateProperty event references the TdxCalculateAutomationPropertyEvent procedural type.

See Also

TdxInitializeAutomationPropertiesEvent Procedural Type

TdxGridCalculateRowAutomationPropertyEvent Procedural Type

dxUIAClasses Unit