Hi,
TUniForm does not pass correct information to RTTI.
Say, you have this declaration:
type
TMainForm = class(TUniForm)
private
{ Private declarations }
public
procedure sayHi;
end;
The RTTI code should should reveal all the methods in the class.
var fCtx: TRttiContext:= TRttiContext.Create;
var form: TMainForm:=MainForm;
var rtype: TRttiType:= fCTx.GetType(form.ClassInfo);
var gg: TArray<string>;
for var method: TRttiMethod in rtype.GetMethods do
begin
SetLength(gg, Length(gg) + 1);
gg[Length(gg) - 1]:=method.Name;
end;
fCtx.Free;
gg array should list all the methods in the class but it misses the sayHi method.
Unfortunately, forcing the compiler to inspect all methods using the following directive does not work
{$RTTI METHODS([vcPublic, vcProtected, vcPrivate])}
On the other hand, if you declare the following class
TTestClass = class
private
procedure method1;
public
procedure method2;
end;
and run the same code gg lists method2 (but, strangely, not method1???).
I suspect the function that returns TMainForm messes up RTTI.
Can anyone think of any work around?