9

In a Delphi class I have some properties that I would like to set by accessing them by their name. Now I use e.g. Settings.AllowSysop := True;

That I would like to do something like Settings('AllowSysop').Value := True;

The reason for this is that when setting what my users can access this is read from a license file where the line read from the file (it is like an INI but encrypted) might look like

AllowSysop = True

I know it is some RTTI look-a-like code that has to be made but I can't quite figure it out.

I think it would make it a bit easier for me if this was possible.

Hope the explanation is making sense

dataol
  • 999
  • 3
  • 19
  • 42
OZ8HP
  • 1,443
  • 4
  • 31
  • 61

1 Answers1

19
implementation
uses TypInfo;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
   if IsPublishedProp (Button1, 'Visible') then
    begin
      SetPropValue (Button1, 'Visible',false);
    end;

end;
bummi
  • 27,123
  • 14
  • 62
  • 101