Recent

Author Topic: TTreeView loadfromfile / savetofile [solved]  (Read 388 times)

aducom

  • Full Member
  • ***
  • Posts: 155
    • http://www.aducom.com
TTreeView loadfromfile / savetofile [solved]
« on: March 16, 2023, 08:37:15 pm »
If I use my treeview savetofile, I get a file containing all items, with indentations, depending on the tree. When I use a loadfromfile of the created file, I only get the first element, where I would expect the same tree as I saved it. Am I overlooking something?
« Last Edit: March 16, 2023, 09:58:44 pm by aducom »

aducom

  • Full Member
  • ***
  • Posts: 155
    • http://www.aducom.com
Re: TTreeView loadfromfile / savetofile
« Reply #1 on: March 16, 2023, 09:57:29 pm »
I found a (better) way:
Code: [Select]
  F := TFileStream.Create(s, fmCreate or fmShareCompat);
  try
    F.WriteComponent(TVDB);  // TVDB is tree
  finally
    F.Free;
  end;

vs

     F := TFileStream.Create(s, fmOpenRead or fmShareDenyWrite);
     try
       F.ReadComponent(TVDB);
     finally
       F.Free;
     end;


jamie

  • Hero Member
  • *****
  • Posts: 6131
Re: TTreeView loadfromfile / savetofile [solved]
« Reply #2 on: March 16, 2023, 11:22:19 pm »
Are you doing something while nodes are being created?
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018