在属性编辑器中如何获取上级属性中的变量值?例如:定义属性编辑器:
    Tp = class(TClassProperty)
    public
        procedure Edit; override;
        function GetAttributes: TPropertyAttributes; override;
    end;定义属性:
    Ta = class(TPersistent)
    private
a:String;
    published
        property sA: string read a write a;
    end;    Tb = class(TPersistent)
    private
bba:ta;
    published
        property sbba: string read bba write bba;
    end;定义组件:
    Tc = class(Components)
    private
fc:String;
cba:ta;
    published
        property scba: string read cba write cba;
    end;注册组件
    RegisterComponents('test', [Tc]);
注册属性编辑器
    RegisterPropertyEditor(TypeInfo(string), Ta, 'sa', Tp)procedure tp..GetValues(proc: TGetStrProc);
Begin
GetComponent(0)得到的只是ta
//如何读取Tc 中的变量Fc
end;

解决方案 »

  1.   

    还有:如果
        Tb = class(TPersistent)
        private
             fb:String;
    bba:ta;
        published
            property sbba: string read bba write bba;
        end;
    //如何读取Tb 中的变量Fb
      

  2.   

    GetComponent的返回值TPersistent,你只用GetComponent(1)就是tb了,tc也是类似的
    (GetComponent(1) as Tb).fb
    不过你应该为fb设置一个属性,因为这里访问的是私有变量记得不是很清楚了,不一定正确