unit UBuscarDir;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.Win.ADODB, Vcl.StdCtrls,
  Vcl.Buttons, Vcl.Grids, Vcl.DBGrids;

type
  TFBuscarDir = class(TForm)
    DBGrid1: TDBGrid;
    Label1: TLabel;
    txtDir: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    DSBuscarDir: TDataSource;
    QBuscarDir: TADOQuery;
    procedure FormCreate(Sender: TObject);
    procedure txtDirChange(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FBuscarDir: TFBuscarDir;

implementation

{$R *.dfm}

uses Udm;

procedure TFBuscarDir.FormActivate(Sender: TObject);
begin
txtDir.SetFocus
end;

procedure TFBuscarDir.FormCreate(Sender: TObject);
begin
 QBuscarDir.Active:= true
end;

procedure TFBuscarDir.txtDirChange(Sender: TObject);
var
   sentencia: string;
begin
   sentencia:= 'Select ide, Area from CatAreas Where Area like ' + chr(39) + '%' + txtDir.Text +  '%' + chr(39);
  with QBuscarDir do
   begin
     active:= false;
     sql.Clear;
     sql.Add(sentencia);
     active:= true;
   end;

end;

end.
