property Objects[Index: Integer]: TObject read GetObject write SetObject;

解决方案 »

  1.   

    不可以。
    有两种方法:
    (1)使用集合对象,即TCollection类对象。
    (2)使用动态数组:
    type
      TObjectDynArray = array of TObject;private
      GetObjects: TObjectDynArray;
      procedure SetObjects(AObjects: TObjectDynArray);
    published
      property Objects: TObjectDynArray read GetObjects write SetObjects(AObject: TObjectDynArray);
    end;
      

  2.   

    更正:
      property Objects: TObjectDynArray read GetObjects write SetObjects;
      

  3.   

    TommyTong(童童--#改变、突破#):
    应该可以的吧,我试过没有问题呀?
      

  4.   

    啊,知道了,原来要这样:
    function GetObject(iIndex: Integer): TObject;
    procedure SetObject(iIndex: Integer; AObject: TObject);不能象我那样:
    function GetObject: TObject);
    procedure SetObject(AObject: TObject);嗯,正谈着恋爱,果然智商下降很多,而且有些形而上学呢。
      

  5.   

    不需要手工写SetObject、GetObject的代码,
    写完
    property Objects[Index: Integer]: TObject read GetObject write SetObject;
    后,按Ctrl-Shift-C,就可以自动生成那些代码了。
      

  6.   

    不能流化!最好用TCollection组合
      

  7.   

    好像不行啊,数组property不能是publish,只能是public,请问你们的情况是怎么样的?
      

  8.   

    应该可以,我曾经用过INTEGER和REAL类型的。
      

  9.   

    不行:
    delphi7会这样说:
    [Error] Unit1.pas(17): Published property 'A' cannot be of type ARRAY
      

  10.   

    我的代码是:
     private
        Fa :array [0..1] of integer;
        { Private declarations }
      public
        { Public declarations }
      published
       property A[index:integer] : integer read geta write seta;
      end;
      

  11.   

    你还没写GetA和SetA函数
    function GetA(Index:Integer):Integer;Virtual;Abstract;
    Procedure SetA(Index:Integer;const val:Integer);Virtual;
      

  12.   


    数组属性只能是public
    如果要放在published要自己定义属性编辑器。