private
{ Private declarations }
FSelPos: integer;
public
{ Public declarations }
end;
var
S : string;
startpos : integer;
begin
with TFindDialog(Sender) do
begin
if FSelPos = 0 then
Options := Options - [frFindNext];
if frfindNext in Options then
begin
StartPos := FSelPos + Length(Findtext);
S := Copy(Memo1.Lines.Text, StartPos, MaxInt);
end
else
begin
S := Memo1.Lines.Text;
StartPos := 1;
end;
FSelPos := Pos(FindText, S);
if FSelPos > 0 then
begin
FSelPos := FSelPos + StartPos - 1;
Memo1.SelStart := FSelPos - 1;
Memo1.SelLength := Length(FindText);
Memo1.SetFocus;
end
else
begin
if frfindNext in Options then
S := Concat('Não há nehuma ocorrência para "', FindText,
'" no memo..')
else
S := Concat('Não foi possível achar: ',findtext);
MessageDlg(S, mtError, [mbOK], 0);
end;
end;
end;
procedure TForm1.Button1Click(Sender : TObject);
begin
//Irá começar a procurar desde 0, lá em cima.
FSelPos := 0;
FindDialog1.Execute;
end;

![]() |
CodigoFonte.net » CodigoFonte.eti.br » Procurando o que comprar? » MeuMural.com.br » Todos os Direitos Reservados © 2002/2008 |
Procurando Notebooks, Câmeras Digitais, iPhones?