[Lazarus] How to create: TButtonGrid descendant of TCustomDrawGrid ?

Juha Manninen (gmail) juha.manninen62 at gmail.com
Sun Aug 29 09:00:34 CEST 2010


On Sunday 29 August 2010 02:54:23 Peter E Williams wrote:
> Hi Howard and All,
> 
> I copied your code (below) into a new application's unit1.pas but I
> could not get it to compile.
> 
> unit1.pas(15,20) Warning: An inherited method is hidden by "constructor
> TButtonGrid.Create(TComponent,LongWord,LongWord);"
> 
> // this would indicate to me that the parameters you have as cardinals
> are supposed to be LongWords. Also, do we have to do something to tell
> Lazarus that this is an inherited constructor???
> 
> unit1.pas(35,1) Error: Illegal expression
> unit1.pas(35,13) Fatal: Syntax error, ";" expected but "identifier
> TBUTTONGRID" found
> 
> type
>    { TButtonGrid }
> 
>    TButtonGrid = class(TStringGrid)
>      public
> //line 15
>        constructor Create(AOwner: TComponent; rowws, colls: cardinal);
>    end;
> 
> { TButtonGrid }
> 
> //line 35
> constructor TButtonGrid.Create(AOwner: TComponent; rowws, colls:
> cardinal);
> var i, j, k: cardinal;
> begin
> 
> Was I meant to save it as TButtonGrid.pas instead ???

No, they are in one unit. It works well here.
You can get rid of the warning by adding "reintroduce;" at the end of 
contructor definition.

Juha




More information about the Lazarus mailing list