Delphi – the accepted way to use frames in Delphi

delphitframe

I was having my usual stroll around and bumped on some frames discussions.

I'm mainly a Delphi hobbyist and not a professional, so I had to learn how to use TFrames my own way which is:

  • Create a TFrame inside its unit.
  • Add that unit to the main form Uses clause.
  • Have a private variable of that TFrame's type
  • OnCreate of the form instanciates the TFrame and attaches it to a TPanel both on the Create and .Parent
  • On one of my Actions set that TFrame.Visible := True and .BringToFront.

This is my practice after some personal deliberation.

What other ways can one use the frames?

Best Answer

That's one way, and there is nothing wrong with it. Another way, is to to do it visually. So you can basically add the frame to a form. to do this you :

  • Create your Frame.
  • Go to the form you wish to put your frame on.
  • Add a Frames component (Standard Tab)
  • Choose your frame from the drop down.
  • That's it!
Related Topic