Move creation of tablecomment from application startup to a place where it's done on demand.

This commit is contained in:
Ansgar Becker
2007-07-03 19:17:54 +00:00
parent 45d617c776
commit 3e2517ee6f
6 changed files with 19 additions and 6 deletions

View File

@ -45,7 +45,6 @@ begin
Application.Title := APPNAME;
Application.CreateForm(TMainForm, MainForm); debug('perf: Main created.');
Application.CreateForm(Ttablecomment, tablecomment); debug('perf: tablecomment created.');
Application.CreateForm(Tloaddataform, loaddataform); debug('perf: loaddata created.');
Application.CreateForm(TprintlistForm, printlistForm); debug('perf: printlist created.');
Application.CreateForm(TCopyTableForm, CopyTableForm); debug('perf: CopyTable created.');

View File

@ -45,7 +45,6 @@ begin
Application.CreateForm(TMainForm, MainForm);
debug('perf: Main created.');
Application.CreateForm(Ttablecomment, tablecomment); debug('perf: tablecomment created.');
Application.CreateForm(Tloaddataform, loaddataform); debug('perf: loaddata created.');
Application.CreateForm(TprintlistForm, printlistForm); debug('perf: printlist created.');
Application.CreateForm(TCopyTableForm, CopyTableForm); debug('perf: CopyTable created.');

View File

@ -35,7 +35,6 @@ begin
Application.CreateForm(TMainForm, MainForm);
Application.CreateForm(Tconnform, connform);
Application.CreateForm(TFieldEditForm, FieldEditForm);
Application.CreateForm(Ttablecomment, tablecomment);
Application.CreateForm(Tloaddataform, loaddataform);
Application.CreateForm(TUserManagerForm, UserManagerForm);
Application.CreateForm(TprintlistForm, printlistForm);

View File

@ -3311,7 +3311,7 @@ end;
procedure TMDIChild.MenuTableCommentClick(Sender: TObject);
begin
// table-comment
tablecomment.showmodal;
tablecommentWindow(self);
end;

View File

@ -46,6 +46,7 @@ object tablecomment: Ttablecomment
Height = 25
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 1
OnClick = ButtonOKClick
end
@ -56,6 +57,7 @@ object tablecomment: Ttablecomment
Height = 25
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2
OnClick = ButtonCancelClick
end

View File

@ -30,8 +30,7 @@ type
{ Public declarations }
end;
var
tablecomment: Ttablecomment;
function tablecommentWindow(AOwner: TComponent): Boolean;
implementation
@ -39,6 +38,21 @@ uses Childwin, helpers, Main;
{$R *.DFM}
{**
Create form on demand
@param TComponent Owner of form (should be calling form)
@return Boolean Form closed using modalresult mrOK
}
function tablecommentWindow(AOwner: TComponent): Boolean;
var
f : Ttablecomment;
begin
f := Ttablecomment.Create(AOwner);
Result := (f.ShowModal=mrOK);
FreeAndNil(f);
end;
procedure Ttablecomment.ButtonCancelClick(Sender: TObject);
begin
close;