From a while back, but still interesting especially because there some differences similar to base/inherited designer objects: [WayBack] vcl – How to do bulk -transformation of form to frame- in Delphi? – Stack Overflow:
Observe the differences of a Form and a Frame in your project.
First the project.dpr source:
program Project1; uses Forms, Unit1 in 'Unit1.pas' {Form1}, Unit3 in 'Unit3.pas' {Frame3: TFrame}; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TForm1, Form1); Application.Run; end.
Differences:
- Frame as a more elaborated comment to tell the IDE which designer it should use
- Form can be autocreate
Dfm files:
object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 348 ClientWidth = 643 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 end
and
object Frame3: TFrame3 Left = 0 Top = 0 Width = 320 Height = 240 TabOrder = 0 end
Frame does not have these properties:
- Caption
- ClientHeight
- ClientWidth
- Color
- Font.Charset
- Font.Color
- Font.Height
- Font.Name
- Font.Style
- OldCreateOrder
- PixelsPerInch
- TextHeight
Sidenote: Frame does not have these events:
- OnCreate
- OnDestroy
A Frame has not global variable like this:
var Form1: TForm1;
And a Frame descends from
TFrame
, whereas a form descends fromTForm
.Note: with Frame/Form inheritence, your steps become a bit longer.
–jeroen
Some of these are similar to the differences you see here:
- Delphi – Frames as visual Components – changing your inheritance
- Delphi – TInterfacedDataModule revisted – use ‘inherited’ in your .dfm files when your datamodules look like forms in the designer
–jeroen
PS: Idea: make a wizard or conversion tool for this.