/examples/dropfiles/unit2.pas

http://github.com/graemeg/lazarus · Pascal · 52 lines · 31 code · 15 blank · 6 comment · 1 complexity · 88e8e13e95bd5be742097ea6a21f552e MD5 · raw file

  1. unit Unit2;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;
  6. type
  7. { TForm2 }
  8. TForm2 = class(TForm)
  9. CheckBox1: TCheckBox;
  10. Label1: TLabel;
  11. procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
  12. procedure CheckBox1Change(Sender: TObject);
  13. private
  14. { private declarations }
  15. public
  16. { public declarations }
  17. end;
  18. var
  19. Form2: TForm2;
  20. implementation
  21. {$R unit2.lfm}
  22. uses
  23. Unit1;
  24. { TForm2 }
  25. procedure TForm2.FormDropFiles(Sender: TObject; const FileNames: array of String);
  26. var
  27. I: Integer;
  28. begin
  29. Form1.Memo1.Lines.Add(IntToStr(Length(FileNames)) + ' file(s) dropped on ' + Name + ':');
  30. for I := 0 to High(FileNames) do
  31. Form1.Memo1.Lines.Add(FileNames[I]);
  32. end;
  33. procedure TForm2.CheckBox1Change(Sender: TObject);
  34. begin
  35. AllowDropFiles := CheckBox1.Checked;
  36. end;
  37. end.