Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-12

Publishing indexed property in descendant

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vojtěch Čihák

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. 
 
 

Reply by email

Michael Van Canneyt
to Vojtěch Čihák
Vojtěch Čihák wrote 26 lines
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".

It is a bug, please post a bug report.

Michael.

Reply by email

Vojtěch Čihák
to Vojtěch Čihák:   is this bug?    { TCompStreamPers }   TCompStreamPers = class(TCustomControl)  …

Done, https://bugs.freepascal.org/view.php?id=32896  
V.
______________________________________________________________

Show quoted text 5 lines
Od: Michael Van Canneyt Komu: FPC-Pascal users discussions Datum: 28.12.2017 16:43 Předmět: Re: [fpc-pascal] Publishing indexed property in descendant
Vojtěch Čihák wrote 26 lines
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".

It is a bug, please post a bug report.

Michael.

----------

Reply by email