TReplaceDialog/zh CN
From Free Pascal wiki
Jump to navigationJump to search
│
English (en) │
français (fr) │
русский (ru) │
中文(中国大陆) (zh_CN) │
TReplaceDialog 替换内容的控件. 在 Dialogs tab 的 Component Palette.
用法
示例:使用 TReplaceDialog 和 TSynEdit. OnReplace 属性在按下替换按钮后执行.
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;
参考资料