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
implementation
uses TypInfo;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if IsPublishedProp (Button1, 'Visible') then
begin
SetPropValue (Button1, 'Visible',false);
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With