Skip to content

TTMSFNCFindDialog

The TTMSFNCFindDialog is a component with predefined specifiers for searching a text. It also supports auto history, closing if a text was found and has an extended view.

Usage

To show the dialog, call the Execute method.

procedure TForm1.Button1Click(Sender: TObject);
begin
  TTMSFNCFindDialog1.Execute;
end;

Use the OnFind and OnFindPrevious events to handle the search. Each events have an AFound parameter that can be set to True if a match was found. If AFound is set to True and the "Close if found" checkbox is enabled, the dialog will automatically close.

procedure TForm1.TMSFNCFindDialog1Find(Sender: TObject; AFindText: string; var AFound: Boolean);
var
  c: Boolean;
begin
  c := fdoCaseSensitive in TTMSFNCFindDialog1.Options;
  if DoMyOwnSearchLogic(AFindText, AMyOriginalText, c) then
    AFound := True;
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 or Previous buttons are clicked or when the dialog is closed.
FindText: string Sets/gets the text inside the search field.
FindList: TStringList A list of values that can be used to select a search item from. AutoHistory is also saved into this list.
Options A set of options to set/get the values of the specifiers.
- fdoCaseSensitive: "Case sensitive" checkbox enabled/disabled
- fdoExpression: "Regular expression" checkbox enabled/disabled
- fdoCloseIfFound: "Close if found" checkbox enabled/disabled
- fdoWholeWordOnly: "Whole world only" checkbox enabled/disabled
- fdoWrapAtEndOfFile: "Wrap at end of file" checkbox enabled/disabled
- fdoContinueToNextFile: "Continue to next file" checkbox enabled/disabled
- fdoSelection: "Selection" checkbox enabled/disabled
- fdoFindEnabled: "Find" button enabled/disabled
- fdoPreviousEnabled: "Previous" button enabled/disabled
- fdoSetMarkerEnabled: "Set marker" button enabled/disabled
- fdoCloseEnabled: "Close" button enabled/disabled
- fdoMoreEnabled: "More" button enabled/disabled
- fdoMoreExpanded: "More" area expanded by default
- fdoDown: "Down" direction is selected by deafult
UILanguage The label settings for each text in the dialog.
VisibleOptions A set of options to add/remove specifiers in the dialog.
- fdovCaseSensitive: "Case sensitive" checkbox visibility
- fdovExpression: "Regular expression" checkbox visibility
- fdovCloseIfFound: "Close if found" checkbox visibility
- fdovWholeWordOnly: "Whole word only" checkbox visibility
- fdovWrapAtEndOfFile: "Wrap at end of file" checkbox visibility
- fdovContinueToNextFile: "Continue to next file" checkbox visibility
- fdovSelection: "Selection" checkbox visibility
- fdovFind: "Find" button visibility
- fdovPrevious: "Previous" button visibility
- fdovSetMarker: "Set marker" button visibility
- fdovClose: "Close" button visibility
- fdovMore: "More" button visibility
- fdovDirection: "Direction" radio selection visibility
- fdovFindCombo: Single-line search combobox visibility
- fdovFindMemo: Multi-line search 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 search field text changes.
OnFindPrevious Event triggered when the "Previous" button is clicked.
OnSetMarker Event triggered when the "Set marker" button is clicked.