Changeset 28 for trunk/UCore.pas


Ignore:
Timestamp:
Sep 10, 2022, 10:21:48 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Do not create all application forms at initialization phase but dynamically.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r26 r28  
    8787procedure TCore.ADatabaseConnectExecute(Sender: TObject);
    8888begin
    89   if FormDatabases.ShowModal = mrOk then begin
    90     DbClient := nil;
    91     DbClient := FormDatabases.SelectedProfile.GetClient;
     89  with TFormDatabases.Create(nil) do
     90  try
     91    if ShowModal = mrOk then begin
     92      DbClient := nil;
     93      DbClient := SelectedProfile.GetClient;
     94    end;
     95  finally
     96    Free;
    9297  end;
    9398end;
     
    106111procedure TCore.APreferencesExecute(Sender: TObject);
    107112begin
    108   FormPreferences.Load(Preferences);
    109   if FormPreferences.ShowModal = mrOk then begin
    110     FormPreferences.Save(Preferences);
     113  with TFormPreferences.Create(nil) do
     114  try
     115    Load(Preferences);
     116    if ShowModal = mrOk then Save(Preferences);
     117  finally
     118    Free;
    111119  end;
    112120end;
     
    125133  if FDbClient = AValue then Exit;
    126134  if Assigned(FDbClient) then begin
     135    FormMain.FormTables.DbClient := nil;
    127136    DbClient.Save;
    128     FDbClient.Free;
     137    FreeAndNil(FDbClient);
    129138  end;
    130139  FDbClient := AValue;
     
    132141    DbClient.Load;
    133142    Preferences.LastDatabaseName := FDbClient.ConnectProfile.Name;
    134     FormTables.DbClient := DbClient;
     143    FormMain.FormTables.DbClient := DbClient;
    135144  end;
    136145  UpdateInterface;
     
    176185      Translator1.POFilesFolder := '/usr/share/MyData/languages';
    177186    {$ENDIF}
    178     FormConnect.Init;
    179187    Initialized := True;
    180188    LoadConfig;
    181     FormDatabases.ReloadList;
    182189    UpdateInterface;
    183190    if Preferences.RememberDatabase then begin
Note: See TracChangeset for help on using the changeset viewer.