Frame not appoearing on Form

I have made extensive use of inherited forms in an application and am looking to use frames to individualise some aspects of the interface.

I am new to frames and with a simple test program to see how they work, my test frame did not appear on the form.

I did the following:

I created a new Form and added a button.

I then created a Frame with a different colour to the Form, and some labels (ie something to see).

I declared the frame as a variable on the form i.e

  Form1: TForm1;
  Frame1: TFrame;

I then put the following code behind the Onclick event of the button I placed on the form

  if Frame1 = nil then
     Frame1 := TFrame.Create(self);
  Frame1.Visible := true;
  Frame1.Align := alTop;
  Frame1.Parent := Form1;

I have also used


When I run the program, and click the button, I can't see the frame. However, if I leave some extraneous labels on the form where the frame it to appear, these disappear when I click the button ie, the frame is there in some spiritual form, but I can't see it. What else do I need to do?

I expect this is an easy question for the gurus, but it is worth 200 points (not 50) to me.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

i can only guess (as You don't provide whole code)

If You have something like this
  TFrame1 = class(TFrame)

You should have

  Form1: TForm1;
  Frame1: TFrame1;  // not TFrame

  if Frame1 = nil then
     Frame1 := TFrame1.Create(self);  // not TFrame
  Frame1.Visible := true;
  Frame1.Align := alTop;
  Frame1.Parent := Form1;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dennis_TreacyAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.