Multiple frames on single form lazarus / 31-LCL ---------------------------------------------------------------------- hakelm · 2022-01-29 10:44 I have a frame, Ttpropertiesframe and try to place several different and independent instances on the same form with: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   properties1:=Ttpropertiesframe.Create(self);  properties1.Parent:=self;   properties2:=Ttpropertiesframe.Create(self);  properties2.Parent:=self;  properties2.Left:=properties1.Left+properties1.Width;  this compiles nicely but when run I get the exception: Project imgcat raised exception class 'EComponentError' with message: Duplicate name: A component named "tpropertiesframe" already exists Why is this so, aren't the different frames just variables of the same type derived from TComponent? H ---------------------------------------------------------------------- MarkMLl · 2022-01-29 11:05 Why are you trying to do it manually rather than using the IDE? MarkMLl ---------------------------------------------------------------------- hakelm · 2022-01-29 11:15 Because I would like to have a little procedure that with a click places around 10 of these frames similar but equipped with different data on a form H ---------------------------------------------------------------------- wp · 2022-01-29 12:06 Yes. The TAChart demo "charteditor" makes massive use of frames, and I saw the same issue when writing this. The problem is that a frame inserted at runtime does get a Name value equal to the class name by default (I consider this to be a bug...). Without the automatic name generation of the Lazarus designtime mode, therefore, two frames of the same type have a name collision, and this must not happen. So, jamie's idea to reset the Name to an empty string after creation of each frame is the correct solution. ---------------------------------------------------------------------- hakelm · 2022-01-29 12:31 Thanks, explanations are as far as I can understand correct, but I can't set the owner since it is read only. I made this little workaround that seems to be working, at least are the subcomponents destructors called on destruction: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   c:tcomponent;................   c:=tcomponent.Create(self);  properties1:=Ttpropertiesframe.Create(c);  properties1.Parent:=self;   c:=tcomponent.Create(self);  properties2:=Ttpropertiesframe.Create(c);  properties2.Parent:=self;  properties2.Left:=properties1.Left+properties1.Width;  H ---------------------------------------------------------------------- Jorg3000 · 2022-01-29 12:59 You don't need to do something with the Owner. Simply set .Name:=''; after the Create. That will do it. So there will be no name collision at the next create. ---------------------------------------------------------------------- hakelm · 2022-01-29 13:19 Thanks, you are right. H