Save/Load a TreeView  

Send By: Radikal (Q3 Team)
Web : http://www.q3.nu
Email: radikal@q3.nu
Date: 15/10/99

Tip accessed 581 times

 


If we have a TreeView in which don't use images for the nodes, we will simply be able to make:


   TV1.SaveToFile('c:\File');



to save the nodes, and:


   TV1.LoadFromFile('c:\File');



to load them

But..that it happens if we use images in the nodes?.
They won't simply be recorded...

The second method is for that:

To record:


 procedure TForm1.Button2Click(Sender: TObject);
 var
    CorrienteF: TFileStream;
 begin
   CorrienteF:=TFileStream.Create('c:\kk\TV1',fmCreate or fmShareCompat);
   CorrienteF.WriteComponent(Tv1);
   CorrienteF.Free;
 end;



And to Load:


 procedure TForm1.Button3Click(Sender: TObject);
 var
    CorrienteF:TFileStream;
 begin
   CorrienteF:=TFileStream.Create('c:\kk\TV1',fmOpenRead or fmShareDenyWrite);
   CorrienteF.ReadComponent(Tv1);
   CorrienteF.Free;
 end;