Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

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

  • 4 Comments sorted by Votes Date Added
  • 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.