   C++Builder_______________________217

   .     
OnFind, ,        ,
  OnReplace, ,     
  .   OnReplace  ,    -
 ,    frReplace  frReplaceAll.

     RichEdit  , -
   FindText,   :

enum TSearchType { stWholeWord, stMatchCase };

typedef Set<TSearchType,stWholeWord,stMatchCase> TSearchTypes;

int   fastcall FindText(const System::AnsiString SearchStr,

int StartPos, int Length, TSearchTypes Options);

     RichEdit ,   Se-
archStr.      StartPos (   
 )   Length .   -
,     stWholeWord (   -
)  stMatchCase (   ).    -
 .     ,  -1.

  ,      
 RichEdit 1.

void_fastcall TFormI::MFindClick(TObject *Sender)

{

/*      ,   RichEditI */

FindDialogl->FindText = RichEditl->SelText;

FindDialogl->Execute();

)
//

void_fastcall TFormI::FindDialoglFind(TObject *Sender)
{

int FoundAt, StartPos, ToEnd;

TSearchTypes Option;

/*   ,      
 ,      */
StartPos = RichEditl->SelStart;

if (RichEditl->SelLength)

StartPos += RichEditl->SelLength;

/* ToEnd   ,         */
ToEnd = RichEditl->Text.Length() - StartPos;

/*           */
if (FindDialogl->Options.Contains(frWholeWord))
Option <:< stWholeWord;

else Option  stWholeWord;

/*    '     

  */

i? CFindDialogI->Options.Contains(frMatchCase))
Option  stMatchCase;

else Option  stMatchCase;

FoundAt = RichEditl->FindText(FindDialogl->FindText, StartPos,
ToEnd, Option);

if (FoundAt != -1) //  
(

RichEditl->SetFocus();