I have a form with aprox with 200 visual components on it, with a lot of events assigned, and I need to change it now to a frame.I don't have enough time to copy all the components,re-arrange all the visual components and re-assign all the events, align, etc. So, I've copied the pas and the dfm, opened and start to edit them in a text editor(change TForm to Tframe, etc) but it seems that this don't get the expected results.
Has anyone an idea on how to solve this?
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:
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:
Sidenote: Frame does not have these events:
A Frame has not global variable like this:
var
Form1: TForm1;
And a Frame descends from TFrame
, whereas a form descends from TForm
.
Note: with Frame/Form inheritence, your steps become a bit longer.
--jeroen
TForm will have additional properties and events which TFrame wont have. You need to remove those properties and events manually to change to form to frame.
Be sure to followed these steps;
TForm1 = class(TForm)
to TForm1 = class(TFrame)
.View as Text
option.View as Form
option.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