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

Frank Church vfclists at gmail.com
Wed Nov 17 18:45:01 CET 2010

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.

  embFrame1 := TEmbBoothFrame.Create(self);
  embFrame1.Parent := Panel10;
  embFrame1.lblDestination.Caption := 'XXXXX';

  embFrame2 := TEmbBoothFrame.Create(self);
  embFrame2.Parent := Panel11;
  embFrame2.lblDestination.Caption := 'YYYYY';

The above code generates the error:

Duplicate name: A component named EmbBoothFrame already exists.

Is it possible to get it to set a new name at creation time? On closer look
it looks like
the use of self means it is being attached to the form, would Application
work much better

ie embFrame1 := TEmbBoothFrame.Create(Application)?

I tested with Application and it works

On the other hand it appears that when I add the frames from the IDE, the
duplicate name issue exists.

Is it possible to pass the desired name to the Create function in this case?

Are frames the right thing for this or is it templates instead? But I can't
find templates in the IDE menu or the palette (Lazarus

Frank Church

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20101117/a993bfce/attachment-0002.html>

More information about the Lazarus mailing list