【发布时间】:2017-01-29 12:28:18
【问题描述】:
我正在实现一个包以在 delphi IDE 中转换和自动生成组件。我知道 GExperts 具有类似的功能,但我需要自定义一些特定的属性。
现在我无法访问 TADOQuery.SQL 属性,它是 TStrings 的一个实例:
var
aVal : TValue;
aSqlS : TStrings;
begin
[...]
if (mycomp.GetComponentType = 'TADOQuery') then
if mycomp.GetPropValueByName('SQL', aVal) then
begin
aSqlS := TStrings(aVal.AsClass);
if Assigned(aSqlS) then <----- problem is here
ShowMessage(aSqlS.Text); <----- problem is here
end;
end;
我不确定使用 RTTI 中的 TValue 是否正确。
谢谢
【问题讨论】:
-
IIRC,
aVal的类型应为IOTAComponent或TIComponentInterface。这取决于mycomp的类型。
标签: delphi delphi-ide opentools