维基副本镜像

这是 pascal.chat 维基的镜像。编辑、历史记录和登录都在那里。

TReplaceDialog/zh CN

English · Français · Русский · 中文(中国)

TReplaceDialog 替换内容的控件. 在 Dialogs tab 的 Component Palette.

]]

用法

示例:使用 TReplaceDialog 和 TSynEdit. OnReplace 属性在按下替换按钮后执行.

pascal
uses
SynEditTypes,
var
opt: TSynSearchOptions; 

//......

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

procedure TMyForm.ReplaceDialog1Replace(Sender: TObject);
var
  k: integer;
begin
  with Sender as TReplaceDialog do begin
    opt := []; 
    if frReplace in Options then
      opt := [ssoReplace]; 
    if frReplaceAll in Options then
      opt := [ssoReplaceAll]; 
    k := SynEdit1.SearchReplaceEx( FindText, ReplaceText, opt, Position );
    if k>=0 then
      SynEdit1.SetFocus()
    else
      Form1.Caption := '...';
  end;
end;

参考资料


From the Free Pascal wiki, page "TReplaceDialog/zh CN", as it stood on 2020-05-02 after a change by TyphonFinger, 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.

版本1,最后由WikiArchive于修改。