mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 10:41:15 +02:00
Implements freeing the accessibility object of individual TTreeView items
git-svn-id: trunk@34891 -
This commit is contained in:
parent
2fb60ec76d
commit
371b050768
@ -165,9 +165,16 @@ end;
|
||||
|
||||
procedure TLazAccessibleObject.RemoveChildAccessibleObject(
|
||||
AObject: TLazAccessibleObject);
|
||||
var
|
||||
lIndex: Integer;
|
||||
begin
|
||||
if FChildren = nil then Exit;
|
||||
FChildren.Remove(@AObject);
|
||||
lIndex := FChildren.IndexOf(AObject);
|
||||
if lIndex >= 0 then
|
||||
begin
|
||||
TLazAccessibleObject(FChildren.Items[lIndex]).Free;
|
||||
FChildren.Delete(lIndex);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLazAccessibleObject.GetChildAccessibleObject(AIndex: Integer): TLazAccessibleObject;
|
||||
|
@ -305,6 +305,8 @@ begin
|
||||
end;
|
||||
|
||||
destructor TTreeNode.Destroy;
|
||||
var
|
||||
lOwnerAccessibleObject, lAccessibleObject: TLazAccessibleObject;
|
||||
begin
|
||||
{$IFDEF TREEVIEW_DEBUG}
|
||||
DebugLn('[TTreeNode.Destroy] Self=',DbgS(Self),' Self.Text=',Text);
|
||||
@ -316,6 +318,15 @@ begin
|
||||
if Assigned(Owner) and Assigned(Owner.Owner) then
|
||||
Owner.Owner.Delete(Self);
|
||||
|
||||
// Remove the accessibility object too
|
||||
if Assigned(Owner) and Assigned(Owner.Owner) then
|
||||
begin
|
||||
lOwnerAccessibleObject := Owner.Owner.GetAccessibleObject();
|
||||
lAccessibleObject := lOwnerAccessibleObject.GetChildAccessibleObjectWithDataObject(Self);
|
||||
if lAccessibleObject <> nil then
|
||||
lOwnerAccessibleObject.RemoveChildAccessibleObject(lAccessibleObject);
|
||||
end;
|
||||
|
||||
// delete children
|
||||
HasChildren := false;
|
||||
// unbind all references
|
||||
|
Loading…
Reference in New Issue
Block a user