delphi Stack OverFlow

hanlinsuile 2016-05-11 09:27:42
如题!下面是代码。想实现遍历全树,然后删除某些没内容的节点。但报Stack OverFlow错误


function TfrmProjCompletedScore.AllOverTreeList(
node: TcxTreeListNode): TcxTreeListNode;
var
BNode: TcxTreeListNode;
begin
while node<>nil do
begin
if node.HasChildren then
begin
node := node.getFirstChild;
AllOverTreeList(node);
if node.Parent <> nil then
node := node.Parent;
end
else
begin
if ((Node.Values[tlWBSProjectName.ItemIndex] = NULL)
or (Node.Values[tlWBSProjectName.ItemIndex] = '')) then
begin
if node.Parent <> nil then
BNode := node.Parent;
node.Delete;
node := BNode;
AllOverTreeList(node);
end;
end;
if node.getNextSibling <> nil then
node := node.getNextSibling
else
Exit;
end;
end;

procedure TfrmProjCompletedScore.cxButton1Click(Sender: TObject);
var
ANode : TcxTreeListNode;
begin
inherited;
with tlWBS.DataController.DataSource.DataSet do
try
tlWBS.BeginUpdate;
DisableControls;
Anode := tlWBS.FocusedNode;
AllOverTreeList(ANode);
finally
tlWBS.EndUpdate;
EnableControls;
end;
end;
...全文
445 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
chengangcsdn 2016-05-12
  • 打赏
  • 举报
回复
应该是造成死循环了

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧