TTMSFNCReplaceDialog
The TTMSFNCReplaceDialog is a component with predefined specifiers for searching and replacing a text. It also supports auto history and has an extended view.
Usage
To show the dialog, call the Execute
method.
Use the OnReplace
and OnReplaceAll
events to handle when the "Replace" and "Replace all" buttons are clicked.
procedure TForm1.TMSFNCReplaceDialog1Replace(Sender: TObject; AFindText: string; AReplaceText: string);
var
c: Boolean;
begin
c := fdoCaseSensitive in TTMSFNCReplaceDialog1.Options;
DoMyOwnReplaceLogic(myOriginalText, AFindText, AReplaceText, c);
end;
More/extended view
When the more/extended view is enabled, "More" button will appear in the bottom right corner. This button can toggle between the single and multi-line search fields. If the multi-line search field is visible the single-line will be disabled. The same events are triggered for both views.
Properties
Property name | Description |
---|---|
AutoHistory: Boolean | If enabled, the search history will automatically will be extended with the current search value when the Find, Replace, Replace all buttons are clicked or when the dialog is closed. |
FindText: string | Sets/gets the text inside the find field. |
FindList: TStringList | A list of values that can be used to select a find item from. AutoHistory is also saved into this list. |
Options | A set of options to set/get the values of the specifiers. - rdoCaseSensitive : "Case sensitive" checkbox enabled/disabled- rdoExpression : "Regular expression" checkbox enabled/disabled- rdoWholeWordOnly : "Whole world only" checkbox enabled/disabled- rdoWrapAtEndOfFile : "Wrap at end of file" checkbox enabled/disabled- rdoSelection : "Selection" checkbox enabled/disabled- rdoFindEnabled : "Find" button enabled/disabled- rdoReplaceEnabled : "Replace" button enabled/disabled- rdoReplaceAllEnabled : "Replace all" button enabled/disabled- rdoCloseEnabled : "Close" button enabled/disabled- rdoMoreEnabled : "More" button enabled/disabled- rdoMoreExpanded : "More" area expanded by default- rdoDown : "Down" direction is selected by deafult- rdoCurrentFile : "Current file" range is selected- rdoAllOpenFiles : "All open files" range is selected |
ReplaceText: string | Sets/gets the text inside the replace field. |
ReplaceList: TStringList | A list of values that can be used to select a replace item from. AutoHistory is also saved into this list. |
UILanguage | The label settings for each text in the dialog. |
VisibleOptions | A set of options to add/remove specifiers in the dialog. - rdovCaseSensitive : "Case sensitive" checkbox visibility- rdovExpression : "Regular expression" checkbox visibility- rdovWholeWordOnly : "Whole word only" checkbox visibility- rdovWrapAtEndOfFile : "Wrap at end of file" checkbox visibility- rdovSelection : "Selection" checkbox visibility- rdovFind : "Find" button visibility- rdovReplace : "Replace" button visibility- rdovReplaceAll : "Replace all" button visibility- rdovClose : "Close" button visibility- rdovMore : "More" button visibility- rdovDirection : "Direction" radio selection visibility- rdovReplaceAllRange : "Replace all range" radio selection visibility- rdovCurrentFile : "Current file" range radio option visibility- rdovAllOpenFiles : "All open files" range radio option visibility- rdovFindCombo : Single-line find combobox visibility- rdovFindMemo : Multi-line find memo visibility- rdovReplaceCombo : Single-line replace combobox visibility- rdovReplaceMemo : Multi-line replace memo visibility |
Methods
Method name | Description |
---|---|
Execute | Shows the dialog. |
Events
Event name | Description |
---|---|
OnClose | Event triggered when the dialog is closed. |
OnFind | Event triggered when the "Find" button is clicked. |
OnFindEditChange | Event triggered when the find field text changes. |
OnReplace | Event triggered when the "Replace" button is clicked. |
OnReplaceAll | Event triggered when the "Replace all" button is clicked. |
OnReplaceEditChange | Event triggered when the replace field text changes. |