home *** CD-ROM | disk | FTP | other *** search
/ PC Expert 29 / Pce29cd.iso / RUNIMAGE / DELPHI40 / DEMOS / EXPERTS / FILTERS.PAS < prev    next >
Pascal/Delphi Source File  |  1998-06-16  |  1KB  |  51 lines

  1. unit Filters;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, Windows, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls;
  8.  
  9. type
  10.   TFilterDlg = class(TForm)
  11.     Label1: TLabel;
  12.     Description: TEdit;
  13.     Label2: TLabel;
  14.     Extension: TEdit;
  15.     Button1: TButton;
  16.     Button2: TButton;
  17.   private
  18.     { Private declarations }
  19.     procedure SetFilter(const Value: string);
  20.     function GetFilter: string;
  21.   public
  22.     { Public declarations }
  23.     property Filter: string read GetFilter write SetFilter;
  24.   end;
  25.  
  26. implementation
  27.  
  28. {$R *.DFM}
  29.  
  30. procedure TFilterDlg.SetFilter(const Value: string);
  31. var
  32.   P: Integer;
  33. begin
  34.   Description.Text := '';
  35.   Extension.Text := '';
  36.   if Value > '' then
  37.   begin
  38.     P := AnsiPos('|', Value);
  39.     if P = 0 then P := 256;
  40.     Description.Text := Copy(Value, 1, P - 1);
  41.     Extension.Text := Copy(Value, P + 1, 255);
  42.   end;
  43. end;
  44.  
  45. function TFilterDlg.GetFilter: string;
  46. begin
  47.   Result := Description.Text + '|' + Extension.Text;
  48. end;
  49.  
  50. end.
  51.