Holy cow, I didn't think that taking references from Properties would work. This completely breaks properties:
TTest = class
private
FTest: Integer;
procedure SetTest(AValue: Integer);
public
property Test1: Integer read FTest;
property Test2: Integer read FTest write SetTest;
end;
{ TTest }
procedure TTest.SetTest(AValue: Integer);
begin
Writeln('set to ', AValue);
FTest := AValue;
end;
var
t: TTest;
p: PInteger;
begin
t := TTest.Create;
p := @t.Test1;
p^ := 42; // just set a read only property
p := @t.Test2;
p^ := 52; // Just circumvented the setter
end.
About the original problem, if you want to address published properties of a control, you can use RTTI, otherwise you probably need some form of dispatching function to do that (for example write a bunch of functions and put them in a string-function pointer map to look up the correct function to call).
Funnily enough, (@t.Test1)^ := ... gives an error that this is not assignable, but the information gets lost when written to p. Note, with a const type concept like C has this would be completely fine to just return a pointer to const, but in pascal this breaks the whole concept of properties