I did that out of laziness, it's simpler for me instead of adding the extra logic. The menu isn't that large anyways.
Putting that aside, I did find something interesting when trying write the Nodes of a TreeView out to an XML using the XMLPropStorage. My XML file is getting messed even though the nodes are reading back correctly, strange?
The menu is attached to this same Treeview in question.
So apparently, LineFeeds, CR , TABS get inserted in the stream which I don't think XML likes

Looking at examples online, very few at that, the SearchReplace call was made to remove these but that isn't the whole story, you actually need those in return for proper population and currently although they repopulate, I think it is causing and unseen memory flood.
I just did some test code and also found that TStringStream.ReadAnsistring; seems not to stop when I hits the end of the stream? So, I have to use the overload that needs a size index.
This of course, seems to be a bug in the TStringStream.
Below is my current test code which I will implement to save the nodes to a XML file using the XMLPropStorage.
procedure TForm1.Button1Click(Sender: TObject);
Var
S:TStringStream;
SS:String;
begin
S:= TStringStream.Create;
Treeview1.SaveToStream(S);
S.Position := 0;
SS:= S.ReadAnsiString(S.Size); //S.ReadAnsiString does not stop at EOS.
SS := EncodeStringbase64(SS);
SS:= DecodeStringBase64(SS);
S.Free;
end;
I used the debugger to inspect the SS contents for validity both ways to ensure correctness.
This allows for restoring the line ending and tabs, it also makes the output smaller so its a win win.
I will see how this step plays out and hope it clears up my mysterious issues.
Thanks.
Jamie