Changeset 153 for trunk/Forms


Ignore:
Timestamp:
Jun 6, 2023, 9:46:08 PM (18 months ago)
Author:
chronos
Message:
  • Added: Accept dropped files onto the application form.
  • Fixed: Report error if compare tool was not found.
Location:
trunk/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormCompare.pas

    r152 r153  
    4444uses
    4545  Core, FormCompareSideBySide, VCardProcessor;
     46
     47resourcestring
     48  SCompareToolNotFound = 'Compare tool ''%s'' not found. Select valid compare tool in the application settings.';
    4649
    4750{ TFormCompare }
     
    150153  SaveStringToFile(TextLeft, TempFileLeft);
    151154  SaveStringToFile(TextRight, TempFileRight);
    152   ExecuteProgram(Core.Core.CompareTool, [TempFileLeft, TempFileRight]);
     155  if FileExists(Core.Core.CompareTool) then
     156    ExecuteProgram(Core.Core.CompareTool, [TempFileLeft, TempFileRight])
     157    else ShowMessage(Format(SCompareToolNotFound, [Core.Core.CompareTool]));
    153158end;
    154159
    155160procedure TFormCompare.CompareExternal;
    156161begin
    157   CompareText(LeftVCard.VCard.AsString, RightVCard.Vcard.AsString,
     162  CompareText(LeftVCard.VCard.AsString, RightVCard.VCard.AsString,
    158163    ExtractFileName(LeftVCard.FileName), ExtractFileName(EditAnotherFile.Text));
    159164end;
  • trunk/Forms/FormMain.lfm

    r152 r153  
    44  Top = 401
    55  Width = 1178
     6  AllowDropFiles = True
    67  Caption = 'vCard Studio'
    78  ClientHeight = 762
     
    1314  OnCreate = FormCreate
    1415  OnDestroy = FormDestroy
     16  OnDropFiles = FormDropFiles
    1517  OnResize = FormResize
    1618  OnShow = FormShow
  • trunk/Forms/FormMain.pas

    r152 r153  
    5959    procedure FormCreate(Sender: TObject);
    6060    procedure FormDestroy(Sender: TObject);
     61    procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
    6162    procedure FormResize(Sender: TObject);
    6263    procedure FormShow(Sender: TObject);
     
    8586resourcestring
    8687  SModified = 'Modified';
     88  SOnlyOneFileCanBeDropped = 'Only one file can be dropped at once.';
    8789
    8890{ TFormMain }
     
    111113begin
    112114  FreeAndNil(FormContacts);
     115end;
     116
     117procedure TFormMain.FormDropFiles(Sender: TObject;
     118  const FileNames: array of string);
     119begin
     120  if Length(FileNames) <> 1 then ShowMessage(SOnlyOneFileCanBeDropped)
     121    else begin
     122      Core.Core.FileOpen(FileNames[0]);
     123      Core.Core.UpdateFile;
     124    end;
    113125end;
    114126
Note: See TracChangeset for help on using the changeset viewer.