home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / delphi / tenpack.lzh / FINDDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-11  |  1KB  |  63 lines

  1. unit finddemo;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, FileCtrl, psfind;
  8.  
  9. type
  10.   TDemoFindText = class(TForm)
  11.     FindText1: TFindText;
  12.     DriveComboBox1: TDriveComboBox;
  13.     DirectoryListBox1: TDirectoryListBox;
  14.     FileListBox1: TFileListBox;
  15.     Label1: TLabel;
  16.     Label2: TLabel;
  17.     Edit1: TEdit;
  18.     Label3: TLabel;
  19.     Edit2: TEdit;
  20.     BitBtn1: TBitBtn;
  21.     Label4: TLabel;
  22.     Edit3: TEdit;
  23.     CheckBox1: TCheckBox;
  24.     Label5: TLabel;
  25.     procedure BitBtn1Click(Sender: TObject);
  26.     procedure CheckBox1Click(Sender: TObject);
  27.   private
  28.     { Private declarations }
  29.   public
  30.     { Public declarations }
  31.   end;
  32.  
  33. var
  34.   DemoFindText: TDemoFindText;
  35.  
  36. implementation
  37.  
  38. {$R *.DFM}
  39.  
  40. procedure TDemoFindText.BitBtn1Click(Sender: TObject);
  41. begin
  42.    findtext1.filename := edit1.text;
  43.    findtext1.findstring := edit2.text;
  44.    findtext1.Searchfile;
  45.    if findtext1.FilePos <> 0 then
  46.    begin
  47.      edit3.text := inttostr(findtext1.Filepos);
  48.    end
  49.    else
  50.      edit3.text := 'Not Found';
  51. end;
  52.  
  53. procedure TDemoFindText.CheckBox1Click(Sender: TObject);
  54. begin
  55.     If checkbox1.state = cbChecked then
  56.       FindText1.Casesensitive := true
  57.     else
  58.       FindText1.Casesensitive := false;
  59.  
  60. end;
  61.  
  62. end.
  63.