Confused by TXMLPropStorage lazarus / 31-LCL ---------------------------------------------------------------------- asdlinux · 2018-07-02 12:18 Hello all, I am new to Lazarus and free pascal. I am sorry if this was asked before or if it is a stupid question. I have looked around and I can't figure out an aswer to my problem/question. I am trying to use TXMLPropStorage. Maybe I have got the whole idea wrong and I am using the wrong component. I have created an application that contains a main form and a configuration form. In both i have a TXMLPropStorage control. In the configuration form I have 3 strings that i save. It works perfectly. When i open the configuration form, it displays the saved data and saves the edited strings. Now to my "problem". In the main form I would like read these string to use them. I am doing 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 TMainWindow.XMLPropStorage1RestoreProperties(Sender: TObject);begin   IMAPServer:=XMLPropStorage1.StoredValue['IMAPServer'];     IMAPUserName:=XMLPropStorage1.StoredValue['IMAPUserName'];     IMAPPassword:=XMLPropStorage1.StoredValue['IMAPPassword'];end;   This is exactly the same working code in the config form. But when I run it in the main form... I get empty strings. Is it possible to read the saved strings from the configuration form and in that case how would i do that? Thank you for your help! Magnus ---------------------------------------------------------------------- af0815 · 2018-07-02 12:40 You can only read or write to the properties (have access)  inside the Event OnRestoreProperties or OnSaveProperties. You can only call Save or Restore, the rest must be handled inside of the events. ---------------------------------------------------------------------- asdlinux · 2018-07-02 13:33 As far as i can tell, I am calling these in OnRestoreProperties event, But in the primary form. I do the same in the original form where it works. ---------------------------------------------------------------------- af0815 · 2018-07-02 13:48 You cannot call the OnRestoreProperties direkt, you can ONLY save or restore your info inside the event. If the event is not called from the XMLPropstorage itself, the data is not valid nor will be written. You can only call eg. XMLPropstorage1.save to store or XMLPropstorage1.restore to receive the data. See Notes in http://wiki.freepascal.org/TXMLPropStorage ---------------------------------------------------------------------- asdlinux · 2018-07-02 14:33 If there is any help, Here is the generated xml file that TXMLPropStorage is saving. In both forms a in having connected events. Code: XML  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i             The names have been changed to protect the innocent As long i do the events on the AccountConf form it works but not in the MainWindow form. ---------------------------------------------------------------------- asdlinux · 2018-07-02 14:34 Note: I am not firing the OnSavingProperties event in the main window because i am only interested in reading them. ---------------------------------------------------------------------- Edson · 2018-07-02 14:42 Take a look to https://github.com/t-edson/MiConfig With this library you can Save/Restore propertties from/to disk: 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  iniFile.FileToProperties;  iniFile.PropertiesToFile;