home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue66 / Shell / FileAssocU2.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-11-11  |  915 b   |  44 lines

  1. unit FileAssocU2;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ComCtrls, StdActns, ActnList, Menus, ImgList;
  8.  
  9. type
  10.   TChildForm = class(TForm)
  11.     RichEdit: TRichEdit;
  12.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  13.   private
  14.     { Private declarations }
  15.   public
  16.     FileName: String;
  17.     constructor Create(AOwner: TComponent; const AFileName: String); reintroduce;
  18.   end;
  19.  
  20. var
  21.   ChildForm: TChildForm;
  22.  
  23. implementation
  24.  
  25. {$R *.DFM}
  26.  
  27. { TChildForm }
  28.  
  29. constructor TChildForm.Create(AOwner: TComponent; const AFileName: String);
  30. begin
  31.   inherited Create(AOwner);
  32.   FileName := AFileName;
  33.   if FileName <> '' then
  34.     RichEdit.Lines.LoadFromFile(FileName);
  35.   Caption := FileName
  36. end;
  37.  
  38. procedure TChildForm.FormClose(Sender: TObject; var Action: TCloseAction);
  39. begin
  40.   Action := caFree
  41. end;
  42.  
  43. end.
  44.