Sign in Join
Wiki copytemporary

Revision 2 of 2, by Trev on 3-1-2020. The page as it is now.

TFindDialog/fr

TFindDialog est un composant non visuel qui donne accès à une boîte de dialogue qui assiste dans la sélection d'un texte à rechercher. . Pour activer un FindDialog, il suffit d'appeler sa méthode Execute(). Créez ensuite un gestionnaire pour l'événement OnFind pour réaliser le code de recherche.

Usage

pascal
procedure TMyForm.Button1Click(Sender: TObject);
begin
  FindDialog1.Execute();
end;

procedure TMyForm.FindDialog1Find(Sender: TObject);
var
  k: integer;
begin
  with Sender as TFindDialog do begin
    k := Pos( FindText, Memo1.Lines.Text );
    if k>0 then begin
      Memo1.Selstart := k;
      Memo1.SelLength := length( FindText );
    end else
      Beep();
  end;
end;

Voir aussi


From the Free Pascal wiki, page "TFindDialog/fr", as it stood on 2020-03-01 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.