[SOLVED] Help with using XMLPropStorage to save RadioBox Selections lazarus / 21-General ---------------------------------------------------------------------- Gizmo · 2023-10-13 22:42 Hi In Tab 1 of my form, I have a list of 7 radio box items in a radio box called "RadioBoxA". But, many users have asked the program to save whatever they last selected, when the form was closed, to be re-used by default when it is next launched. For example, if they selected "Option 5" from RadioBoxA, instead of the default "Option 1", they want it to save "Option 5" and default to that when it is next launched. I gather the best way to achieve this is using XMLPropStorage But, I am at a loss as to how to actually get the last selected Radio Box option to be saved in the XML file, and then read and used the next time it is launched. I found this, https://wiki.lazarus.freepascal.org/TXMLPropStorage which comes close to explaining it with check box, but after spending some time on it this evening, I am no closer (I am rusty as I've not coded for almost a year!) Could anyone give me some layman direction? I just don't quite get how the "SavedValues" elements etc correlate to the selected RadioBox option. ---------------------------------------------------------------------- wp · 2023-10-13 23:03 Drop a TXMLPropStorage on the form. Select the form. Double-click on the property SessionProperties of the form. You see three lists. The left list shows the components on the form. Select the first components for which you want to save properties. The right list then displays the published properties of this component. Select the property that you want to store, and click "Add". Now the property to be saved appears in the bottom list. Repeat with all properties that you want to save. Then repeat with the next component. All the properties to be saved (i.e. the bottom list) are displayed as a semicolon-separated string in the property SessionProperties, e.g. Code: [Select]Height;Left;RadioGroup1.ItemIndex;Top;Width;WindowState; RadioButton1.Checked;RadioButton2.Checked;RadioButton3.Checked Test the attached simple project ---------------------------------------------------------------------- Gizmo · 2023-10-14 13:34 Well that is the best and most helpful guide I've ever seen! We should add your description to the official docs (unless it is there and I just havent found it). It literally took me 30 seconds to do it once I read that. I had no idea it was that simple. Thanks so much!! ---------------------------------------------------------------------- wp · 2023-10-14 15:52 @Gizmo: I updated the wiki @jamie: Yes - see yourself in the attached project. ---------------------------------------------------------------------- jamie · 2023-10-14 19:11 I noticed Delphi does not have this ability; I may be a little reluctant to use it. ---------------------------------------------------------------------- Gizmo · 2023-10-15 00:00 Good work WP. In case I or anyone else comes here in future, the updated wiki page that WP has modified is : https://wiki.lazarus.freepascal.org/TXMLPropStorage