[Lazarus] Should using frames result in duplicate name errors?

Frank Church vfclists at gmail.com
Thu Nov 18 10:56:18 CET 2010


On 18 November 2010 09:41, Marc Weustink <marc.weustink at cuperus.nl> wrote:

> Steve Smith wrote:
>
>> On Wed, 17 Nov 2010 17:45:01 +0000 Frank Church <vfclists at gmail.com>
>> wrote
>>
>>  I am trying to use frames to create the same element repeatedly on a
>>>
>> form,
>>
>>> but when I copy them in the IDE or create them and set their parents
>>>
>> at
>>
>>> runtime, I get duplicate name errors. Isn't Lazarus supposed to give
>>>
>> them
>>
>>> different names.
>>>
>>
>> How can Lazarus do it? You are entering code directly. If you use the IDE
>> to add frames, Lazarus will do it for you. If you wish to do it in code
>> CORRECTLY, do the following.
>>
>> embFrame1 := TEmbBoothFrame.Create(self);
>> embFrame1.Name := 'embBoothFrame1';
>> embFrame1.Parent := Panel10;
>> embFrame1.lblDestination.Caption := 'XXXXX';
>>
>> embFrame2 := TEmbBoothFrame.Create(self);
>> embFrame2.Name := 'embBoothFrame2';
>> embFrame2.Parent := Panel11;
>> embFrame2.lblDestination.Caption := 'YYYYY';
>>
>> Alternatively, you can add code in the TEmbBoothFrame constructor yourself
>> to build unique names.
>>
>> There is a routine somewhere to generate a unique name but I can't be
>> bothered to search for it.
>>
>
> BTW, if you onlt create components in code, you don't have to give it a
> name.
>
> Marc
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>

Templates were what I had in mind initially,
http://delphi.about.com/library/howto/htcomptemplate.htm, but I can't find
them in the IDE (Lazarus 0.9.28.3),
Are they available in Lazarus.

-- 
Frank Church

=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20101118/34a8087f/attachment-0003.html>


More information about the Lazarus mailing list