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:
This is my practice after some personal deliberation.
What other ways can one use the frames?
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 :
The only problem with your approach is that you cannot add multiple instances of the same frame to a given form:
Frame1 := TMyFrame.Create(Self);
Frame1.Parent := Self;
// ...
Frame2 := TMyFrame.Create(Self); // bombs out with "a component with the name MyFrame already exists"
The workaround for his is to assign a different name for each instance:
Frame1 := TMyFrame.Create(Self)
Frame1.Parent := Self;
Frame1.Name := "FirstFrame";
// ...
Frame2 := TMyFrame.Create(Self); // works now, there is no name conflict
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With