home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue29 / art_tips / ART_TIPS.ZIP / Tips / Examples / Win32 / unitMain.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1997-10-08  |  942 b   |  50 lines

  1. unit unitMain;
  2.  
  3. interface
  4.  
  5. uses
  6.   Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Tips;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Tips1: TTips;
  12.     procedure FormActivate(Sender: TObject);
  13.     procedure FormCreate(Sender: TObject);
  14.     procedure FormDestroy(Sender: TObject);
  15.   private
  16.     { Private declarations }
  17.   public
  18.     { Public declarations }
  19.   end;
  20.  
  21. const
  22.   fFileName: string = 'Tips.dat';
  23.  
  24. var
  25.   Form1: TForm1;
  26.  
  27. implementation
  28.  
  29. {$R *.DFM}
  30.  
  31. procedure TForm1.FormActivate(Sender: TObject);
  32. begin
  33.   Tips1.Execute;
  34. end;
  35.  
  36. procedure TForm1.FormCreate(Sender: TObject);
  37. begin
  38.   fFileName := ExtractFilePath(ParamStr(0)) + fFileName;
  39.   if FileExists(fFileName) and (ofShowBtnEdit in Tips1.Options) then
  40.   Tips1.LoadFromFile(fFileName);
  41. end;
  42.  
  43. procedure TForm1.FormDestroy(Sender: TObject);
  44. begin
  45.   if (ofShowBtnEdit in Tips1.Options) then Tips1.SaveToFile(fFileName);
  46. end;
  47.  
  48.  
  49. end.
  50.