【发布时间】:2013-02-07 02:24:27
【问题描述】:
我想创建一个表单,将其类名作为字符串which has been asked about before,但我不想调用GetClass,而是想使用Delphi 的新RTTI 功能。
有了这段代码,我有一个TRttiType,但我不知道如何实例化它。
var
f:TFormBase;
ctx:TRttiContext;
lType:TRttiType;
begin
ctx := TRttiContext.Create;
for lType in ctx.GetTypes do
begin
if lType.Name = 'TFormFormulirPendaftaran' then
begin
//how to instantiate lType here?
Break;
end;
end;
end;
我也试过lType.NewInstance,但没有成功。
【问题讨论】:
标签: delphi delphi-xe2 rtti