Commit 2a0df745 authored by Juha Manninen's avatar Juha Manninen
Browse files

LCL: Do not call TTreeView.OnCollapsing and OnCollapsed during clearing the items. Issue #38084.

git-svn-id: trunk@64142 -
parent 7a03920d
......@@ -2836,8 +2836,8 @@ type
nsVisible, // = Node.Visible
nsBound // bound to a tree, e.g. has Parent or is top lvl node
);
TNodeStates = set of TNodeState;
TNodeAttachMode = (
naAdd, // add as last sibling of Destination
naAddFirst, // add as first sibling of Destination
......@@ -2978,7 +2978,7 @@ type
function CompareCount(CompareMe: Integer): Boolean;
function DoCanExpand(ExpandIt: Boolean): Boolean;
procedure DoExpand(ExpandIt: Boolean);
procedure ExpandItem(ExpandIt: Boolean; Recurse: Boolean);
procedure ExpandItem(ExpandIt, Recurse: Boolean);
function GetAbsoluteIndex: Integer;
function GetDeleting: Boolean;
function GetHasChildren: Boolean;
......
......@@ -698,7 +698,6 @@ end;
procedure TTreeNode.ExpandItem(ExpandIt: Boolean; Recurse: Boolean);
var
//Flag: Integer;
ANode: TTreeNode;
begin
if Recurse then begin
......@@ -1287,7 +1286,8 @@ end;
procedure TTreeNode.Unbind;
// unbind from parent and neighbor siblings, but not from owner
var OldIndex, i: integer;
var
OldIndex, i: integer;
HigherNode: TTreeNode;
TheTreeView: TCustomTreeView;
begin
......@@ -1347,8 +1347,13 @@ begin
ReAllocMem(FParent.FItems,SizeOf(Pointer)*FParent.FCapacity);
end;
if FParent.Count=0 then begin
FParent.Expanded:=false;
FParent.HasChildren:=false;
TheTreeView.BeginUpdate;
try
FParent.Expanded:=false;
FParent.HasChildren:=false;
finally
TheTreeView.EndUpdate;
end;
end;
FParent:=nil;
end;
......@@ -5474,7 +5479,8 @@ end;
procedure TCustomTreeView.GetImageIndex(Node: TTreeNode);
begin
if Assigned(FOnGetImageIndex) then FOnGetImageIndex(Self, Node);
if Assigned(FOnGetImageIndex) then
FOnGetImageIndex(Self, Node);
end;
procedure TCustomTreeView.GetSelectedIndex(Node: TTreeNode);
......@@ -5485,7 +5491,8 @@ end;
function TCustomTreeView.CanChange(Node: TTreeNode): Boolean;
begin
Result := True;
if Assigned(Node) and Assigned(FOnChanging) then FOnChanging(Self, Node, Result);
if Assigned(Node) and Assigned(FOnChanging) then
FOnChanging(Self, Node, Result);
end;
procedure TCustomTreeView.Change(Node: TTreeNode);
......@@ -5499,39 +5506,44 @@ begin
if Assigned(FOnDeletion) then FOnDeletion(Self, Node);
end;
procedure TCustomTreeView.Expand(Node: TTreeNode);
function TCustomTreeView.ExpandSignSizeIsStored: Boolean;
begin
UpdateScrollbars;
if Assigned(FOnExpanded) then FOnExpanded(Self, Node);
Result := FExpandSignSize >= 0;
end;
function TCustomTreeView.ExpandSignSizeIsStored: Boolean;
procedure TCustomTreeView.Expand(Node: TTreeNode);
begin
Result := FExpandSignSize >= 0;
UpdateScrollbars;
if Assigned(FOnExpanded) and not (tvsUpdating in FStates) then
FOnExpanded(Self, Node);
end;
function TCustomTreeView.CanExpand(Node: TTreeNode): Boolean;
begin
Result := True;
if Assigned(FOnExpanding) then FOnExpanding(Self, Node, Result);
if Assigned(FOnExpanding) and not (tvsUpdating in FStates) then
FOnExpanding(Self, Node, Result);
end;
procedure TCustomTreeView.Collapse(Node: TTreeNode);
begin
UpdateScrollbars;
if Assigned(FOnCollapsed) then FOnCollapsed(Self, Node);
if Assigned(FOnCollapsed) and not (tvsUpdating in FStates) then
FOnCollapsed(Self, Node);
end;
function TCustomTreeView.CanCollapse(Node: TTreeNode): Boolean;
begin
Result := True;
if Assigned(FOnCollapsing) then FOnCollapsing(Self, Node, Result);
if Assigned(FOnCollapsing) and not (tvsUpdating in FStates) then
FOnCollapsing(Self, Node, Result);
end;
function TCustomTreeView.CanEdit(Node: TTreeNode): Boolean;
begin
Result := True;
if Assigned(FOnEditing) then FOnEditing(Self, Node, Result);
if Assigned(FOnEditing) then
FOnEditing(Self, Node, Result);
end;
procedure TCustomTreeView.EndEditing(Cancel: boolean);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment