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

This commit is contained in:
Ansgar Becker
2007-07-03 19:31:06 +00:00
parent fe6d534120
commit bf73dadbd3
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(TprintlistForm, printlistForm); debug('perf: printlist created.');
Application.CreateForm(TCopyTableForm, CopyTableForm); debug('perf: CopyTable created.');
Application.CreateForm(TFormEditUser, FormEditUser); debug('perf: EditUser created.');
Application.CreateForm(TfrmSQLhelp, frmSQLhelp); debug('perf: frmSQLhelp created.');

View File

@ -45,7 +45,6 @@ begin
Application.CreateForm(TMainForm, MainForm);
debug('perf: Main created.');
Application.CreateForm(TprintlistForm, printlistForm); debug('perf: printlist created.');
Application.CreateForm(TCopyTableForm, CopyTableForm); debug('perf: CopyTable created.');
Application.CreateForm(TFormEditUser, FormEditUser); debug('perf: EditUser created.');
Application.CreateForm(TfrmSQLhelp, frmSQLhelp); debug('perf: frmSQLhelp created.');

View File

@ -36,7 +36,6 @@ begin
Application.CreateForm(Tconnform, connform);
Application.CreateForm(TFieldEditForm, FieldEditForm);
Application.CreateForm(TUserManagerForm, UserManagerForm);
Application.CreateForm(TprintlistForm, printlistForm);
Application.CreateForm(TCopyTableForm, CopyTableForm);
Application.CreateForm(TFormEditUser, FormEditUser);
Application.Run;

View File

@ -789,7 +789,7 @@ begin
// TODO: Print data
end
else
printlistform.showmodal;
printlistWindow(self);
end;

View File

@ -112,6 +112,7 @@ object printlistForm: TprintlistForm
Height = 25
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 4
OnClick = Button2Click
end
@ -122,6 +123,7 @@ object printlistForm: TprintlistForm
Height = 25
Caption = 'Print'
Default = True
ModalResult = 1
TabOrder = 3
OnClick = Button3Click
end

View File

@ -36,8 +36,7 @@ type
{ Public declarations }
end;
var
printlistForm: TprintlistForm;
function printlistWindow(AOwner: TComponent): Boolean;
implementation
@ -45,6 +44,21 @@ uses childwin, main;
{$R *.DFM}
{**
Create form on demand
@param TComponent Owner of form (should be calling form)
@return Boolean Form closed using modalresult mrOK
}
function printlistWindow(AOwner: TComponent): Boolean;
var
f : TprintlistForm;
begin
f := TprintlistForm.Create(AOwner);
Result := (f.ShowModal=mrOK);
FreeAndNil(f);
end;
procedure TprintlistForm.FormShow(Sender: TObject);
var
i,t : Integer;