From 0e271ee7deb588e0f9037f31abf00ec4d3b43d46 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sun, 21 Feb 2010 10:44:55 +0000 Subject: [PATCH] Replace remaining loadXYZwindow() functions for dialogs by a more native way. --- source/copytable.pas | 15 --------------- source/loaddata.pas | 15 --------------- source/main.pas | 14 ++++++++++---- 3 files changed, 10 insertions(+), 34 deletions(-) diff --git a/source/copytable.pas b/source/copytable.pas index 23532682..8b3b5ee7 100644 --- a/source/copytable.pas +++ b/source/copytable.pas @@ -42,8 +42,6 @@ type { Public declarations } end; - function CopyTableWindow(AOwner: TComponent): Boolean; - implementation @@ -51,19 +49,6 @@ uses 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 CopyTableWindow(AOwner: TComponent): Boolean; -var - f : TCopyTableForm; -begin - f := TCopyTableForm.Create(AOwner); - Result := (f.ShowModal=mrOK); - FreeAndNil(f); -end; procedure TCopyTableForm.radioStructureClick(Sender: TObject); diff --git a/source/loaddata.pas b/source/loaddata.pas index 71f70678..a6a50531 100644 --- a/source/loaddata.pas +++ b/source/loaddata.pas @@ -72,7 +72,6 @@ type { Public declarations } end; - function loaddataWindow(AOwner: TComponent): Boolean; implementation @@ -81,20 +80,6 @@ uses Main, helpers; {$R *.DFM} -{** - Create form on demand - @param TComponent Owner of form (should be calling form) - @return Boolean Form closed using modalresult mrOK -} -function loaddataWindow(AOwner: TComponent): Boolean; -var - f : Tloaddataform; -begin - f := Tloaddataform.Create(AOwner); - Result := (f.ShowModal=mrOK); - FreeAndNil(f); -end; - {** FormCreat diff --git a/source/main.pas b/source/main.pas index 89c42b35..64355ade 100644 --- a/source/main.pas +++ b/source/main.pas @@ -18,7 +18,7 @@ uses CommCtrl, Contnrs, Generics.Collections, routine_editor, trigger_editor, options, EditVar, helpers, createdatabase, table_editor, TableTools, View, Usermanager, SelectDBObject, connections, sqlhelp, mysql_connection, - mysql_api, insertfiles, searchreplace; + mysql_api, insertfiles, searchreplace, loaddata, copytable; type @@ -791,6 +791,8 @@ type InsertFiles: TfrmInsertFiles; EditVariableForm: TfrmEditVariable; SearchReplaceDialog: TfrmSearchReplace; + ImportTextfileDialog: Tloaddataform; + CopyTableDialog: TCopyTableForm; // Virtual Tree data arrays VTRowDataListVariables, @@ -923,7 +925,7 @@ const implementation uses - About, loaddata, printlist, copytable, mysql_structures, UpdateCheck, uVistaFuncs, runsqlfile, + About, printlist, mysql_structures, UpdateCheck, uVistaFuncs, runsqlfile, column_selection, data_sorting, grideditlinks; @@ -1818,7 +1820,9 @@ end; procedure TMainForm.actImportCSVExecute(Sender: TObject); begin // Import Textfile - loaddataWindow(self); + if not Assigned(ImportTextfileDialog) then + ImportTextfileDialog := Tloaddataform.Create(Self); + ImportTextfileDialog.ShowModal; end; procedure TMainForm.actPreferencesExecute(Sender: TObject); @@ -1941,7 +1945,9 @@ end; procedure TMainForm.actCopyTableExecute(Sender: TObject); begin // copy table - CopyTableWindow(self); + if not Assigned(CopyTableDialog) then + CopyTableDialog := TCopyTableForm.Create(Self); + CopyTableDialog.ShowModal; end;