[SOLVED] Undo/redo in TSTringGrid with TStream lazarus / 31-LCL ---------------------------------------------------------------------- carlangas · 2024-10-06 18:34 I am sure this must be obvious, but I couldn't manage to find out an easy way to implement undo/redo in a StringGrid using TStream, which I see in this forum as a convenient solution. This is what I do: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var Copia: TMemoryStream; ... Copia:=TMemoryStream.Create; ...  LaTabla.SaveToStr eam(Copia); ... LaTabla.LoadFromStream(Copia);   When loading from the stream, I get an Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i In 'stream:' (line 1 pos 1): Root element is missing. error. What I want to do is to back up the content of the grid and be able to restore it. What is the mistake I make? ---------------------------------------------------------------------- bobby100 · 2024-10-06 20:27 Dunno if SaveOptions are affecting the SaveToStream, but this looks like SaveOptions problem. ---------------------------------------------------------------------- jamie · 2024-10-06 20:48 Did you reset the Position back to 0 before trying to reload it? ---------------------------------------------------------------------- carlangas · 2024-10-07 08:03 Exactly. It was that. I did not manage to find a usage example for doing so. It was just a matter of doing Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Copia.Position:=0; before loading it back. So, for anyone having the same issue and not finding the needed doc, this is how I end up doing it:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var Copia: TMemoryStream; ... Copia:=TMemoryStream.Create; ...  LaTabla.SaveToStr eam(Copia); ... Copia.Position:=0; LaTabla.LoadFromStream(Copia);  Thanks, Jamie.