0
我正在實現一個包,用於在delphi IDE中轉換和自動生成組件。我知道GExperts具有類似的功能,但我需要定製一些特定的屬性。Delphi OpenTools API獲取組件屬性
現在我卡在訪問TADOQuery.SQL
屬性,它是字符串列表一個實例:我真的不知道是否使用TValue從RTTI是正確的方式來
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;
走。
感謝
IIRC,'aVal'應該是'IOTAComponent'或'TIComponentInterface'類型。它取決於'mycomp'的類型。 –