Skip to content

Find All Results Panel

Steve Towner edited this page May 15, 2016 · 3 revisions

Overview

The Find All Results Panel is a control that can be placed onto a form or inside another control which can display the results from an Incremental Search or Find and Replace dialog Find All command.

Moving the mouse or clicking on a line to select it will cause the Scintilla control that was searched to go to that instance of the found text. Double clicking does the same, but also gives focus to the Scintilla control.

The picture below shows the results panel at the bottom of the form showing results from a search of 'the'.

Find All Results Panel

Usage

The FindReplace class raises an event when a Find All command is executed. The event contains all the locations of the found text. Passing the event data to the Find All Results Panel causes it to populate with the line number and the line text for each found item. To enable the Scintilla to jump to the item when click on the in the results, the Find All Results instance is given a reference to the control.

using ScintillaNET_FindReplaceDialog;

        public Form1()
        {
            InitializeComponent();


            MyFindReplace = new FindReplace(scintilla1);
            // Hook into find all results event
            MyFindReplace.FindAllResults += MyFindReplace_FindAllResults;

            // Hook the Find All Results Panel to the Scintilla that is being searched.
            findAllResultsPanel1.Scintilla = scintilla1;
        }

        private void MyFindReplace_FindAllResults(object sender, FindResultsEventArgs FindAllResults)
        {
            // Pass on find results which will populate the screen.
            findAllResultsPanel1.UpdateFindAllResults(FindAllResults.FindReplace, FindAllResults.FindAllResults);
        }
Clone this wiki locally