Código
procedure Edit1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
Var
Aux : Integer;
Posicao : Integer;
begin
Try
Query1.Active := False;
Query1.SQL.Clear;
If Edit1.Text <> '' then
begin
Query1.SQL.Add('SELECT * FROM TABELA WHERE CAMPO LIKE ' + #39 + Edit1.Text + #37 + #39 + ' ORDER BY CAMPO');
Query1.Active := True;
If Query1.FieldByName('CAMPO').AsString <> '' then
begin
Posicao := length(Edit1.Text);
For Aux := length(Edit1.Text)+1 to Length(Query1.FieldByName('Tratamento').AsString) do
begin
Edit1.Text := Edit1.Text + Query1.FieldByName('Tratamento').AsString[Aux];
end;
Edit1.SelStart := Posicao;
Edit1.SelLength := length(Edit1.Text);
end;
end;
Except
end;
end;
procedure Edit1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
Var
Aux : Integer;
Posicao : Integer;
begin
Try
Query1.Active := False;
Query1.SQL.Clear;
If Edit1.Text <> '' then
begin
Query1.SQL.Add('SELECT * FROM TABELA WHERE CAMPO LIKE ' + #39 + Edit1.Text + #37 + #39 + ' ORDER BY CAMPO');
Query1.Active := True;
If Query1.FieldByName('CAMPO').AsString <> '' then
begin
Posicao := length(Edit1.Text);
For Aux := length(Edit1.Text)+1 to Length(Query1.FieldByName('Tratamento').AsString) do
begin
Edit1.Text := Edit1.Text + Query1.FieldByName('Tratamento').AsString[Aux];
end;
Edit1.SelStart := Posicao;
Edit1.SelLength := length(Edit1.Text);
end;
end;
Except
end;
end;
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009