Commit a1aea6a2 authored by wp's avatar wp
Browse files

LCL/TreeView: Fix OnExpand* events not firing any more after r64142 #2a0df745. Issue #38084.

git-svn-id: trunk@64855 -
parent 59f20b58
......@@ -3193,7 +3193,6 @@ type
function GetCount: Integer;
function GetOwner: TPersistent; override;
procedure SetItem(Index: Integer; AValue: TTreeNode);
procedure SetUpdateState(Updating: Boolean);
public
constructor Create(AnOwner: TCustomTreeView);
destructor Destroy; override;
......@@ -3269,7 +3268,6 @@ type
tvsIsEditing,
tvsStateChanging,
tvsManualNotify,
tvsUpdating,
tvsPainting,
tvoFocusedPainting,
tvsDblClicked,
......
......@@ -2596,29 +2596,20 @@ end;
procedure TTreeNodes.BeginUpdate;
begin
if FUpdateCount = 0 then SetUpdateState(True);
Inc(FUpdateCount);
end;
procedure TTreeNodes.SetUpdateState(Updating: Boolean);
procedure TTreeNodes.EndUpdate;
begin
//SendMessage(Handle, WM_SETREDRAW, Ord(not Updating), 0);
if Updating then
Include(Owner.FStates,tvsUpdating)
else begin
Exclude(Owner.FStates,tvsUpdating);
Dec(FUpdateCount);
if FUpdateCount = 0 then
begin
Include(Owner.FStates,tvsScrollbarChanged);
Owner.UpdateScrollbars;
Owner.Invalidate;
end;
end;
procedure TTreeNodes.EndUpdate;
begin
Dec(FUpdateCount);
if FUpdateCount = 0 then SetUpdateState(False);
end;
procedure TTreeNodes.FreeAllNodeData;
var
i: Integer;
......@@ -4872,7 +4863,7 @@ var
Node: TTreeNode;
InsertMarkRect: TRect;
begin
if [tvsUpdating,tvsPainting] * FStates <> [] then Exit;
if [tvsPainting] * FStates <> [] then Exit;
Include(FStates, tvsPainting);
try
if Focused then
......@@ -5549,28 +5540,32 @@ end;
procedure TCustomTreeView.Expand(Node: TTreeNode);
begin
UpdateScrollbars;
if Assigned(FOnExpanded) and not (tvsUpdating in FStates) then
if Assigned(FOnExpanded) then
FOnExpanded(Self, Node);
end;
function TCustomTreeView.CanExpand(Node: TTreeNode): Boolean;
begin
Result := True;
if Assigned(FOnExpanding) and not (tvsUpdating in FStates) then
if Assigned(FOnExpanding)then
FOnExpanding(Self, Node, Result);
end;
procedure TCustomTreeView.Collapse(Node: TTreeNode);
begin
if csDestroying in ComponentState then
exit;
UpdateScrollbars;
if Assigned(FOnCollapsed) and not (tvsUpdating in FStates) then
if Assigned(FOnCollapsed) then
FOnCollapsed(Self, Node);
end;
function TCustomTreeView.CanCollapse(Node: TTreeNode): Boolean;
begin
Result := True;
if Assigned(FOnCollapsing) and not (tvsUpdating in FStates) then
if csDestroying in ComponentState then
exit;
if Assigned(FOnCollapsing) then
FOnCollapsing(Self, Node, Result);
end;
......
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