Can I get a PTypeInfo from a string?
Posted
by Mason Wheeler
on Stack Overflow
See other posts from Stack Overflow
or by Mason Wheeler
Published on 2010-05-26T17:48:03Z
Indexed on
2010/05/26
17:51 UTC
Read the original article
Hit count: 289
This is probably going to be a "no", but is there any way I can use Delphi's RTTI, either old-school or the 2010 extended RTTI, to pass in a string containing the name of a type, specifically the name of an enumerated type, and have it give me the PTypeInfo for that type? I've looked through RTTI.pas and TypInfo.pas and I don't see any function that would do that, but I might have missed something.
What I'm looking for:
var
info: PTypeInfo;
begin
info := GetTypeInfoFromName('TComponentStyle');
end;
Or something like that. Thing is, the name of the enumerated type would be passed in; it wouldn't be known at compile time.
© Stack Overflow or respective owner