Sign in Join
Wiki copytemporary

TReplaceDialog: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: TReplaceDialog

OldNewLine
1+**TReplaceDialog** ![](/wiki-images/2/2d/Treplacedialog.png) is a component that aids in search and replace textinformation. It can be found on the [[Dialogs tab]] of the [[Component Palette]].
2+
3+![](/wiki-images/2/20/Component-TReplaceDialog.png)\]\]
4+
5+## Usage
6+
7+An example to use a [[TReplaceDialog]] with a [[TSynEdit]]. The `OnReplace` will be executed when the 'Replace' button within the dialog is pressed.
8+
9+``` pascal
10+procedure TMyForm.Button1Click(Sender: TObject);
11+begin
12+ ReplaceDialog1.Execute();
13+end;
14+
15+procedure TMyForm.ReplaceDialog1Replace(Sender: TObject);
16+var
17+ k: integer;
18+begin
19+ with Sender as TReplaceDialog do begin
20+ opt := [];
21+ if frReplace in Options then
22+ opt := [ssoReplace];
23+ if frReplaceAll in Options then
24+ opt := [ssoReplaceAll];
25+ k := TSynEdit1.SearchReplaceEx( FindText, ReplaceText, opt, Position );
26+ if k>=0 then
27+ TSynEdit1.SetFocus()
28+ else
29+ Beep();
30+ end;
31+end;
32+```
33+
34+## See also
35+
36+- [[doc:lcl/dialogs/treplacedialog.html|TReplaceDialog doc]]
37+- [[TFindDialog]]
38+
39+---
40+*From the Free Pascal wiki, page "TReplaceDialog", 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](/wiki-contact).*

Back to history