Ver Mensaje Individual
  #8  
Antiguo 27-06-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola Leonardo.

Código Delphi [-]
....
implementation

var
  Nivel: TStrings;

procedure TForm1.FormCreate(Sender: TObject);
var
  nodo0,nodo1,nodo2,nodo3,nodo4: TTreeNode;
  ix: Integer;
begin
  Nivel:= TStringList.Create;
  ix:=0;
  nodo0:= tvCatalogo.Items.AddFirst(nil, 'ARTICULOS');
  while not Qry_Cata.Eof do
  begin
    Nivel.Add(Qry_Cata.FieldByName('Nivel').AsString);
    case Length(Nivel[ix]) of
      2: nodo1:= tvCatalogo.Items.AddChildObject(nodo0,
            Qry_Cata.FieldByName('Texto').AsString, Pointer(Nivel[ix]));
      4: nodo2:= tvCatalogo.Items.AddChildObject(nodo0,
            Qry_Cata.FieldByName('Texto').AsString,Pointer(Nivel[ix]));
      6: nodo3:= tvCatalogo.Items.AddChildObject(nodo0,
            Qry_Cata.FieldByName('Texto').AsString,Pointer(Nivel[ix]));
      8: nodo4:= tvCatalogo.Items.AddChildObject(nodo0,
            Qry_Cata.FieldByName('Texto').AsString,Pointer(Nivel[ix]));
    end;
    Qry_Cata.Next;
    Inc(ix);
  end;
  tvCatalogo.FullExpand;
end;
procedure TForm1.tvCatalogoClick(Sender: TObject);
begin
  with tvCatalogo do
    if Assigned(Selected) and (Selected.Level > 0) then
       ShowMessage(string(Selected.Data));
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  Nivel.Free;
end;

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 27-06-2012 a las 05:01:39.
Responder Con Cita