[Lazarus] Namespace

Marcos Douglas md at delfire.net
Wed Jan 12 19:49:24 CET 2011


On Wed, Jan 12, 2011 at 3:26 PM, Mattias Gaertner
<nc-gaertnma at netcologne.de> wrote:
> On Wed, 12 Jan 2011 15:00:51 -0300
> Marcos Douglas <md at delfire.net> wrote:
>
>> 2011/1/12 Mattias Gaertner <nc-gaertnma at netcologne.de>:
>> >> But I can register a component called TButton?
>> >
>> > No, that would conflict with the LCL TButton. See the FCL function
>> > FindClass.
>>
>> I know.
>>
>> >> Because that I proposed the Lazarus put the unit name in the code,
>> >> automatic...
>> > Just use the right unit order.
>>
>> What is that mean?
>
> It means, that instead of
>
> use StdCtrls, MyEdit;
>
> TForm1 = class(TForm)
>  e1: StdCtrls.TEdit;
>  e2: StdCtrls.TEdit;
>  e3: StdCtrls.TEdit;
>  e4: StdCtrls.TEdit;
> end;
>
> .. you can simply use:
>
> use MyEdit, StdCtrls;
>
> TForm1 = class(TForm)
>  e1: TEdit;
>  e2: TEdit;
>  e3: TEdit;
>  e4: TEdit;
> end;

Ah, okay, I  remembered this... but in Delphi I used <StdCtrls,
MyEdit> instead of <MyEdit, StdCtrls>. Right to Left, no?
Anyway... this is a "hack" not a "pure" implementation. You use the
design time of TButton (LCL) but in runtime the button will behave
differently. I think this is not a good idea (I used this hack to
extend the default components in Delphi, e.g., coloring the all
TDBGrid's lines in a project).

Marcos Douglas




More information about the Lazarus mailing list