[lazarus] Code pattern question

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Nov 7 11:56:51 EST 2002

On Thu, 07 Nov 2002 17:49:00 +0100
Michal Bukovjan <bukovjan at mbox.dkm.cz> wrote:

> Hi,
> when looking at the code of Lazarus (not LCL), I found that quite often 
> when we create a control (say, in constructor), we do it quite often via 
> code like:
> AControl:= TControl.Create(AOwner)
> with AControl do begin
>    Parent ...
>    Name:= 'LongControlName';
>    Visible:= true;
> end;
> Is setting up Name and Visible (to true) necessary?
> 'Name' does not make sense for controls created like this and visibility 
> is always true by default.
> Is there any reason, or can this be cleaned up (over time, not 
> necessarily now), (reducing Lazarus size somewhat).

It helps debugging, profiling and someday to turn it into a lfm file. 
For example: When the gtk calls one of our callbacks, you can see
'CompilerPathComboBox:TButton' instead of 'TButton' and so you know
instantly what is going on.

The visible is set to true for historical reasons, when visible was false as
default. These lines can be deleted.

But I doubt that deleting one thousand lines will reduce much. We produce
this amount every week.


More information about the Lazarus mailing list