TTreeView persist to file

Hi there
Anyone willing/able to share some ideas on reading/writing a large tree to disk as fast as possible? From memory, I recall VCL version has a read/write to xml, but for some reason us FMX users are expected to create our own!

My working idea is very simple: iterate over the treeview items using a GetNextItem function e.g. half way down How to sequentially browse all nodes of a TTreeView under Firemonkey and Delphi XE3? - Stack Overflow appending the item’s Level and Text properties into a stringlist, then it can be easily written out and read back in.

Obviously, BeginUpdate and EndUpdate increases the speed during the read.

Sadly, I think accessing a TreeViewItem “Items” property might be slowing it down as its not that fast
Ideas appreciated
Cheers
Aneal

I have been working on FMX TTreeview for some time and there is not much info about that specifically refers to this object and it is confused in google searches with the VCL component.and others.
If you haven’t already, Have a look at for using code like Treeview1.globalcount For i = 0 to globacount -1 do… to iterate through. set the global index to the first item then use global index to iterate through the treeview. by globalIndex [Index] or go from last to first.
If you want to make one data aware then that can be a problem.
I use a table with a IDNo/autoinc as the table index and a parentId as part of the index a habit from using the developer express data aware treeview and Treelists. I create the table in a client datset nrowser I have created.
So I create a normal treeview structure in the table where the parid can be searched to find it’s children and loop through, then using a text field for the Treeviewitem text and create a label or edit inside the Ttreeviewitem at runtime using
“aTvItem := TTreeViewItem.Create(Self);”
aTvItem.Text := aCds.FieldByName(‘Item’).AsString; //text is the tvitem property not a child object
aTvItem.parent := aTreeview;
Then I create additional child objects as follows
aLabel := TLabel.Create(self);
atvItem.AddObject(aLabel2);
aLabel.Align := TAlignLayout.MostRight;
aLabel.Width := 35;
aLabel.Text := IntToStr(aCds.FieldByName(‘IdNo’).asInteger); // or IntToStr(nId);
aLabel.TextSettings.font.size := 10;
aLabel.parent := aTvItem;

Then display or otherwise hide that.I also add my own check boxes and images to the treeviewitem as child objects and use them in the display.Then I have code in the TTTreeview onclick event to locate the record in the associated table using the index created from the table sd sbovr (different from the global index whish is from memory of displayed items only. Each treeview item child object has it’s own child index and you can get it’s data as a TValue. and convert it . The on click event of a child object can be utilised but I have so far not needed to do that as mine are more display than functional and I didn’t want my Treeview to be editable just a record browsing mechanism.for the next mobile tab
Hope this helps if not I have buckets of code I reserched most of which was for earlier versions of delphi before Xe10.