Difference between revisions of "TFindDialog"
From Lazarus wiki
Jump to navigationJump to searchLine 16: | Line 16: | ||
var | var | ||
src: String; | src: String; | ||
+ | k: integer; | ||
begin | begin | ||
with Sender as TFindDialog do begin | with Sender as TFindDialog do begin |
Revision as of 12:32, 11 September 2016
TFindDialog is a component that aids in finding information. It can be found on the Dialogs tab of the Component Palette.
To activate a FindDalilog, just call its Execute() function. Create an OnFind method to perform the actual find.
Usage
procedure TMyForm.Button1Click(Sender: TObject);
begin
FindDialog1.FindText := 'findme';
FindDialog1.Execute();
end;
procedure TMyForm.FindDialog1Find(Sender: TObject);
var
src: String;
k: integer;
begin
with Sender as TFindDialog do begin
src := ReplaceDialog1.FindText;
k := Pos( src, Memo1.Lines.Text );
if k>0 then begin
Memo1.Selstart := k;
Memo1.SelLength := length( src );
end else
Beep();
end;
end;
See also