[fpc-pascal] Publishing indexed property in descendant

Vojtěch Čihák vojtech.cihak at atlas.cz
Thu Dec 28 15:41:40 CET 2017


Hi,
 
is this bug?
 
 { TCompStreamPers }
  TCompStreamPers = class(TCustomControl)
  private
    function GetItem(AIndex: Integer): TPersItem;
    procedure SetItem(AIndex: Integer; AValue: TPersItem);
  protected
    FItems: TFPObjectList;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  //published
    property Item[AIndex: Integer]: TPersItem read GetItem write SetItem;
  end;
 
  TCompStreamPers2 = class(TCompStreamPers)
  published
    property Item;
  end;
         
If I try to publish property Item in TCompStreamPers, compiler rejects with "compstreampers.pas(31,19) Error: This kind of property cannot be published".
 
But when I do it in descendant class, compiler is silent. Delphi7 does not allow it: "[Error] Unit2.pas(35): Published property 'Item' cannot be of type ARRAY".
 
Thanks for reply,
 
V. 
 
 



More information about the fpc-pascal mailing list