-3

我有一个程序将使用 TurboPower Orpheus 的 OvcViewr.pas 中的 TOvcFileViewer 打开并显示一个文本文件。我想知道是否有办法搜索文本,或者我是否必须以不同的方式加载和搜索文件?

procedure TForm1.Open1Click(Sender: TObject);  
begin
   if OpenDialog1.Execute then begin
    with Viewer8 do begin
      FileName := OpenDialog1.Filename;
      IsOpen := True;
    end;
end;
end;
4

1 回答 1

1

使用公共TOvcFileViewer.Search方法。

OvcViewr.pas

function Search(const S : string; Options : TSearchOptionSet) : Boolean;
  {-search for a string returning True if found}
  override;

并来自 OvcData.pas:

type
  {Search option flags for editor and viewer}
  TSearchOptions = (
    soFind,        {find  (this option is assumed)        }
    soBackward,    {search backwards                      }
    soMatchCase,   {don't ignore case when searching      }
    soGlobal,      {search globally                       }
    soReplace,     {find and replace         (editor only)}
    soReplaceAll,  {find and replace all     (editor only)}
    soWholeWord,   {match on whole word only (editor only)}
    soSelText);    {search in selected text  (editor only)}
  TSearchOptionSet = set of TSearchOptions;
于 2013-10-30T20:40:00.387 回答