I have a unit which defines a frame (FrameCom) and then in another form I declare two private variables:

I have a unit which defines a frame (FrameCom) and then in another form I declare two private variables:

private
fFrame1,
fFrame2: TFrameCom;

In the Create event of the form I initialise the first frame:

fFrame1:=TFrameCom.Create(self);
fFrame1.Parent:=self;

All good here.

Then I add the code for the second frame:

fFrame2:=TFrameCom.Create(self);
fFrame2.Parent:=self;

and I get a runtime AV complaining that "A component named FrameCom already exists"

Can I not have more than one frames in the form?

Comments

  1. fFrame2:=TFrameCom.Create(self);
    fFrame2.Name:='SecondFrame';
    fFrame2.Parent:=self;

    ReplyDelete
  2. Alexander Sviridenkov Is this because I create them on run-time?

    ReplyDelete
  3. John KouraklisYes, at design-time name is changed automatically

    ReplyDelete

Post a Comment