Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #12  
Antiguo 07-06-2010
Avatar de danilochavez
danilochavez danilochavez is offline
Registrado
 
Registrado: oct 2007
Ubicación: Xela
Posts: 1
Poder: 0
danilochavez Va por buen camino
Función recursiva en un TreeView

Hey guys...somewhere I found a very good and effective algorithm you are trying I guess...

procedure DirectoryTree(Tree:TTreeView;Memo1:TMemo ; RootDirectory:string);
var
sr: TSearchRec;
FileAttrs: Integer;
theRootNode : tTreeNode;
theNode : tTreeNode;

procedure AddDirectories(theNode: tTreeNode; cPath: string);
var
sr: TSearchRec;
FileAttrs: Integer;
theNewNode : tTreeNode;
begin
FileAttrs := faAnyFile; //TSearchRec constant
if FindFirst(cPath+'\*.*', FileAttrs, sr) = 0 then
begin
repeat
if ((sr.Attr and FileAttrs) = sr.Attr) and (copy(sr.Name,1,1) <> '.')
then
begin
theNewNode := Tree.Items.AddChild(theNode,sr.name);
AddDirectories(theNewNode,cPath+'\'+sr.Name);
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;

begin
FileAttrs := faAnyFile; //TSearchRec constant
theRootNode := Tree.Items.AddFirst(nil,RootDirectory);
if FindFirst(RootDirectory+'*.*', FileAttrs, sr) = 0 then
begin
theNode := Tree.Items.GetFirstNode;
AddDirectories(theNode,RootDirectory+sr.Name);
FindClose(sr);
end;
end;
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 13:41:58.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi