unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,
DB, Grids, DBGrids, DBTables, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
DBGrid1: TDBGrid;
DataSource1: TDataSource;
timer1: TTimer;
label1: TLabel;
Query1: TQuery;
procedure FormKeyPress(Sender: TObject;
var Key: Char);
procedure FormCreate(Sender: TObject);
procedure timer1Timer(Sender: TObject);
private
FSearchFor:
string;
procedure SetSearchFor(
const Value:
string);
{ Private-Deklarationen }
public
{ Public-Deklarationen }
property SearchFor :
string read FSearchFor
write SetSearchFor ;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormKeyPress(Sender: TObject;
var Key: Char);
begin
timer1.enabled := false ;
SearchFor := SearchFor + key ;
Query1.Locate('
lastname',SearchFor,[loCaseInsensitive,loPartialKey]) ;
Timer1.enabled := true ;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
SearchFor := '
' ;
end;
procedure TForm1.timer1Timer(Sender: TObject);
begin
SearchFor := '
' ;
timer1.enabled := false ;
end;
procedure TForm1.SetSearchFor(
const Value:
string);
begin
FSearchFor := Value;
label1.caption := SearchFor ;
end;
end.