When using VirtualStringTree to add accessibility support it is required to include the unit VirtualTrees.Accessibility
in the uses
section. This works in Delphi.
The equivalent of this in C++ Builder would be to include the #include "VirtualTrees.Accessibility.hpp"
. But including the include file doesn't have any effect.
I've traced the problem to the VirtualTrees.Accessibility.pas
file and it executes a few lines of code to register the default accessibility provider in Delphi while this code is absent from the hpp file. So including the hpp does include the class but not the code which registers the provider.
The code in question (at the end of VirtualTrees.Accessibility.pas
is this):
var
DefaultAccessibleProvider: TVTDefaultAccessibleProvider;
DefaultAccessibleItemProvider: TVTDefaultAccessibleItemProvider;
MultiColumnAccessibleProvider: TVTMultiColumnAccessibleItemProvider;
initialization
if DefaultAccessibleProvider = nil then
begin
DefaultAccessibleProvider := TVTDefaultAccessibleProvider.Create;
GetAccessibilityFactory.RegisterAccessibleProvider(DefaultAccessibleProvider);
end;
if DefaultAccessibleItemProvider = nil then
begin
DefaultAccessibleItemProvider := TVTDefaultAccessibleItemProvider.Create;
GetAccessibilityFactory.RegisterAccessibleProvider(DefaultAccessibleItemProvider);
end;
if MultiColumnAccessibleProvider = nil then
begin
MultiColumnAccessibleProvider := TVTMultiColumnAccessibleItemProvider.Create;
GetAccessibilityFactory.RegisterAccessibleProvider(MultiColumnAccessibleProvider);
end;
finalization
GetAccessibilityFactory.UnRegisterAccessibleProvider(MultiColumnAccessibleProvider);
MultiColumnAccessibleProvider := nil;
GetAccessibilityFactory.UnRegisterAccessibleProvider(DefaultAccessibleItemProvider);
DefaultAccessibleItemProvider := nil;
GetAccessibilityFactory.UnRegisterAccessibleProvider(DefaultAccessibleProvider);
DefaultAccessibleProvider := nil;
end.
My question - how do I translate or use the above so I can have accessibility support from C++ Builder as well after including the VirtualTrees.Accessibility.hpp
file? A translation of the above into C++ would be very appreciated.