TFindDialogOptions (C++)
Description
The following code calls the user-defined routine DoReplace if the Replace button was clicked or calls the user-defined routine DoReplaceAll if the Replace All button was clicked. Place a TReplaceDialog, a TButton, and a TRichEdit on the form.
Code
void __fastcall TForm1::ReplaceDialog1Replace(TObject *Sender)
{
TReplaceDialog *dlg = dynamic_cast<TReplaceDialog *>(Sender);
if (dlg->Options.Contains(frReplace))
DoReplace(dlg->FindText, dlg->ReplaceText);
else if (dlg->Options.Contains(frReplaceAll))
DoReplaceAll(dlg->FindText, dlg->ReplaceText);
}
void __fastcall TForm1::DoReplace(String FindText, String ReplaceText)
{
ShowMessage(
L"DoReplace: FindText: " + ReplaceDialog1->FindText +
L" ReplaceText: " + ReplaceDialog1->ReplaceText);
};
void __fastcall TForm1::DoReplaceAll(String FindText, String ReplaceText)
{
ShowMessage(
L"DoReplaceAll: FindText: " + ReplaceDialog1->FindText +
L" ReplaceText: " + ReplaceDialog1->ReplaceText);
};
Uses
- Vcl.Dialogs.TFindDialog.Options ( fr | de | ja )
- Vcl.Dialogs.TReplaceDialog.ReplaceText ( fr | de | ja )