What are TFrames, and how are they useful?

By: Christopher Moeller

Abstract: Using a TFrame to create your own specialized "control panels."

Question:

Is it possible to group sets of controls together as a single component?

Answer:

Yes, through the use of TFrames.

If you going to be arranging sets of similar controls for your application(s), you may wish to consider using a TFrame to create a "component template."  A TFrame is like a TForm in that it is a container for other controls.  In this way, you may drag and drop all of the controls that you wish to use onto the TFrame.  As an added feature, however, you may then store the TFrame into the Component Palette.  Then, when you wish to utilize your new component, you may drag and drop the "bundle" of controls, now represented as a single icon in the Component Palette, on any particular Form.  The controls may be edited once the TFrame is dropped onto a TForm and may be nested in either TForms or other TFrames.  In addition, after a TFrame is created and saved, it continues to function as a unit and inherits changes from the components (including other frames) it contains. Also, an embedded TFrame continues to inherit changes made to the frame from which it is derived.

Here is an example:

-File  |  Close All
-File  |  New Frame
-Drop buttons, edit boxes, etc. on the TFrame
-File  |  Save Project
-Right-click on the TFrame
-Choose "Add to Palette"
-Select a name and palette page (e.g. Samples)
-Click OK
-Notice that the new component is now found in the Component Palette, and may be dropped to a TForm or TFrame


Server Response from: ETNASC03