Home > Back-end >  Delphi Stack OverFlow
Delphi Stack OverFlow

Time:09-23

If inscribe! Below is the code to traverse all tree, then delete some contents of the node, but shall be reported to the Stack OverFlow error
 


The function TfrmProjCompletedScore. AllOverTreeList (
Node: TcxTreeListNode) : TcxTreeListNode;
Var
BNode: TcxTreeListNode;
The begin
While node<> Nil do
The begin
If the node. The HasChildren then
The begin
Node:=node. GetFirstChild;
AllOverTreeList (node);
If the node. The Parent & lt;> Nil then
Node:=node. The Parent;
End
The else
The begin
If ((Node Values [tlWBSProjectName ItemIndex]=NULL)
Or (Node Values [tlWBSProjectName ItemIndex]=' ')) then
The begin
If the node. The Parent & lt;> Nil then
BNode:=node. The Parent;
Node. Delete;
Node:=BNode;
AllOverTreeList (node);
end;
end;
If the node. GetNextSibling & lt;> Nil then
Node:=node getNextSibling
The else
The Exit;
end;
end;

Procedure TfrmProjCompletedScore. CxButton1Click (Sender: TObject);
Var
ANode: TcxTreeListNode;
The begin
Inherited;
With tlWBS. DataController. The DataSource. The DataSet do
Try
TlWBS. BeginUpdate;
DisableControls;
Anode:=tlWBS. FocusedNode;
AllOverTreeList (ANode);
The finally
TlWBS. EndUpdate;
EnableControls;
end;
end;

CodePudding user response:

Should be caused the infinite loop
  • Related