如題!下面是代碼。想實作遍歷全樹,然后洗掉某些沒內容的節點。但報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;
uj5u.com熱心網友回復:
應該是造成死回圈了轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/69255.html
標籤:語言基礎/算法/系統設計
