Thema: Delphi Treeview

Einzelnen Beitrag anzeigen

marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#6

Re: Treeview

  Alt 21. Jul 2005, 12:04
Da haste:

Delphi-Quellcode:
function TreeContains(node: TTreeNode; nodeText: string): boolean;
begin
  Result := (node.Text = nodeText);
  if Result or (node.Count = 0) then Exit;
  node := node.getFirstChild;
  repeat
    Result := Result or TreeContains(node, nodeText);
    node := node.getNextSibling;
  until not Assigned(node) or Result;
end;

procedure TreeClean(node: TTreeNode; nodeText: string);
begin
  if TreeContains(node, nodeText) then begin
    node := node.GetLastChild;
    while Assigned(node) do begin
      TreeClean(node, nodeText);
      node := node.getPrevSibling;
    end
  end else
    node.Delete;
end;
Grüße vom marabu
  Mit Zitat antworten Zitat