-2

I have a added components on a form object dynamically

Edit1 := TEdit.Create(form3);

I have got the object form3 of Tform class. Now what i want to do is I want to create a component template of form3 so that I can just drag and drop that component template on any of my other from and all the components present in it will be automatically available for me to use. Can any one help me with how to about doing component template?

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • 4
    Your question is totally unclear. If you're creating components in code, but want to embed your form as a component, you started wrong in the first place. Start over, using `File->New->Other->Delphi Files->Frame` - `TFrame` was designed with **exactly** this use in mind. Doing it otherwise is just a waste of time and effort. – Ken White Jun 28 '12 at 17:44
  • 1
    What may I ask is a `TFrom` object? – Jerry Dodge Jun 28 '12 at 19:43

1 Answers1

5

From the second part of your question it seems you want to make a reuseable Frame that you can drop at design time on a form, and drag it around. Frames can be dropped multiple times on multiple forms. Changes in the design are reflected in the copies. Create a frame with File > New > Frame (Delphi 7) or File > New > Other > Delphi Projects > Delphi Files > VCL Frame (XE2).

However, if the components therein should also be visible during designing, then you have to create those controls also at designtime. A frame works exactly like a normal form, so there should be no problem there. Controls generated in code will only show up at runtime, which is just fine if you want that.

NGLN
  • 43,011
  • 8
  • 105
  • 200