Changeset 8 for trunk/UCore.pas


Ignore:
Timestamp:
Feb 1, 2018, 12:51:32 PM (7 years ago)
Author:
chronos
Message:
  • Added: Show all fields tab in contact form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r3 r8  
    8282  SAppExit = 'Application exit';
    8383  SAppExitQuery = 'File was modified. Do you want to save it before exit?';
     84  SFileNotFound = 'File ''%s'' not found.';
    8485
    8586{ TCore }
     
    188189procedure TCore.DataModuleDestroy(Sender: TObject);
    189190begin
     191  FileClose;
    190192  SaveConfig;
    191193end;
     
    204206procedure TCore.FileOpen(FileName: string);
    205207begin
    206   FileClose;
    207   if FileClosed then begin
    208     FileNew;
    209     DataFile.LoadFromFile(FileName);
    210     LastOpenedList1.AddItem(FileName);
    211   end;
     208  if FileExists(FileName) then begin
     209    FileClose;
     210    if FileClosed then begin
     211      FileNew;
     212      DataFile.LoadFromFile(FileName);
     213      LastOpenedList1.AddItem(FileName);
     214    end;
     215  end else ShowMessage(Format(SFileNotFound, [FileName]));
    212216end;
    213217
     
    232236  end else DoClose := True;
    233237  if DoClose then begin
    234     FreeAndNil(DataFile);
     238    if Assigned(DataFile) then FreeAndNil(DataFile);
    235239    FileClosed := True;
    236240  end;
Note: See TracChangeset for help on using the changeset viewer.