I've implemented a search using the TFindDialog on my开发者_C百科 form. Everything works well except that I cannot find a way to mimic the "F3 - Find Next" behaviour as in Notepad. Once you have entered a search string, pressing F3 finds the next instance without opening the search dialog.
Regards, Pieter.
Here's a sketch how one could do this:
type
  TForm1 = class(TForm)
    FindDialog1: TFindDialog;
    procedure FindDialog1Find(Sender: TObject);
    procedure SearchFind1Execute(Sender: TObject);
    procedure SearchFindNext1Execute(Sender: TObject);
  private
    FSearchText: string;
    procedure Search;
  end;
and
procedure TForm1.Search;
begin
  // Do the real searching here...
  MessageBox(Handle, PChar('Looking for "' + FSearchText + '".'), nil, 0);
end;
procedure TForm1.SearchFind1Execute(Sender: TObject);
begin
  // Triggered by Ctrl-F
  FindDialog1.FindText := FSearchText;
  FindDialog1.Execute;
end;
procedure TForm1.SearchFindNext1Execute(Sender: TObject);
begin
  // Triggered by F3
  if FSearchText = '' then
    SearchFind1.Execute
  else
    Search;
end;
procedure TForm1.FindDialog1Find(Sender: TObject);
begin
  // Triggered by button click in FindDialog1
  FSearchText := FindDialog1.FindText;
  Search;
end;
Alternativaly you could try the standard actions TSearchFind/TSearchFindNext. However I haven't tried them myself, so I can't say how well they work in practice.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论