TForm.ProcessResource lazarus / 31-LCL ---------------------------------------------------------------------- sam707 · 2017-09-03 13:45 does anyone had to reload default controls values and properties at runtime, for a form to display reintitialized, with its embeded lfm resource? until today I was making a procedure setting checkboxes, Edits, Radiobuttons (and so on) to what values I gave at design time if a 'reset to default' button/action was executed. I saw yesterday that TForm has a method named 'ProcessResource' which loads the defaults values after the widget's creation. So I made something like this : 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 procedure TMForm.RstActionExecute(Sender: TObject);begin  Visible:=false;  MainMenu.Free;  repeat    Components[Pred(ComponentCount)].Free; // clean form, destroy childs  until ComponentCount = 0;  Application.ProcessMessages; // sync tthe deletions with widgetset  ProcessResource; // load lfm res, recreate internally children with designtime values  CreateWnd; // widgetset recreate Form  Visible:=true;end; and I debuged the whole thing ensuring there was no error. all went fine until tne final 'end'; then I ran to continue the program but a wonderful SIGSEGV poped should I continue to use a self made reset procedure assigning default values and properties, or is there a way to reload them nicely from the embeded lfm resource, with no SIGSEGV? by advance, thank you ---------------------------------------------------------------------- jamie · 2017-09-03 14:17 Have you considered not recreating the window ? ---------------------------------------------------------------------- sam707 · 2017-09-03 15:52 recreating completely the main form assumes to destroy it, if so, application then will terminate, thats problem. I need a reread the original state from resource, Form should not be totally destroyed, even more if it is the MAIN form ==> end of program createWnd being commented out I have the same result. I call it because it resets the Form caption ---------------------------------------------------------------------- howardpc · 2017-09-03 18:35 You have to do this the hard way, iterating each property you want to be reset. See the attached project for an idea. Implementation of Assign is rather hit-and-miss for most controls, so there is no generalised way of reliably cloning arbitrary properties that I am aware of. ---------------------------------------------------------------------- sam707 · 2017-09-03 20:07 wow thanks @howardpc, that's a clever idea! ==> create a new form from the class, and copy back values and properties. I was expecting Lazarus 'TForm.Processresource' method to inplace reinit/reread the form's components... but ok, your temporary form solution seems a good one. Unfortunately, it consumes much more memory and resources than my (I thought) 'obsolete' way to call a procedure that set values and properties progammatically. SO, i"am adding to my lazarus wishlist => a method to reload default components/contros values/props, in the state as they were at designtime.