This forum is temporaily read-only. All existing discussions remain available for reference. For new questions, bug reports or support requests, please contact us at mail@lmdsupport.com.

Can I save program variables with LMDStorPropertiesStorage?

Hi Team,
I would like to save a program variable automatically and re-load automatically a.k.a LMDStorPropertiesStorage.
Can I do it with the above component?  If so, please advise how.
If not.  Can you suggest an alternative mechanism?

Regards & TIA,
Ian

Comments

  • The answer is - Yes.
    I used the CustomProperties Property.  Have to read/write them manually in the program but saving/loading happens as with component properties.
    Regards,
    Ian
  • Yes, ecactly. Thanks for feedback :-)
  • Hi,
    I don't find a way to do this.
    There is a little example?

    Thanks!
  • Assuming you populated CustomProperties collection at design-time with the list of your desired custom properties, specifying the Name and possibly default value for each, you can access it in code like this:

    procedure TForm1.MyButtonClick(Sender: TObject);
    var
      pp: TLMDStorCustomProperty;
    begin
      pp := LMDStorPropertiesStorage1.CustomProperties.FindItem('MyProp');
      if pp <> nil then
        pp.Value := 7; // Write or read custom property value.
    end;

    You can do this while your application running, e.g. after the state has been read at startup and before it will be saves on shutdown.
Sign In or Register to comment.