Publishing indexed property in descendant

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Publishing indexed property in descendant

vojtech.cihak
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. 
 
 
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Publishing indexed property in descendant

Michael Van Canneyt


On Thu, 28 Dec 2017, Vojtěch Čihák wrote:

> 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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Publishing indexed property in descendant

vojtech.cihak
In reply to this post by vojtech.cihak

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

 

V.

______________________________________________________________
> Od: Michael Van Canneyt <[hidden email]>
> Komu: FPC-Pascal users discussions <[hidden email]>
> Datum: 28.12.2017 16:43
> Předmět: Re: [fpc-pascal] Publishing indexed property in descendant
>



On Thu, 28 Dec 2017, Vojtěch Čihák wrote:

> 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.

----------

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal