align="justify"> {FindDialog1- gt; FindText=RichEdit1- gt; SelText; - gt; Execute ();
}
//---------------------------------------------------------------------------__fastcall TForm1 :: FindDialog1Find (TObject * Sender)
{FoundAt, StartPos, ToEnd; Option; * dlg=(TReplaceDialog *) Sender; (dlg- gt; Options.Contains (frWholeWord)) lt; lt; stWholeWord; Option gt; gt; stWholeWord; (dlg- gt; Options.Contains (frMatchCase)) lt; lt; stMatchCase; Option gt; gt; stMatchCase;=RichEdit1- gt; FindText (dlg- gt; FindText ,, ToEnd, Option); (FoundAt!=- 1)
{RichEdit1- gt; SelStart=FoundAt; - gt; SelLength=dlg- gt; FindText.Length (); ((dlg- gt; Name == laquo;ReplaceDialog1raquo;)amp;amp;(dlg-gt;Options.Contains(frReplaceAll)))Replace(Sender);}ShowMessage(laquo;Текст ' + dlg- gt; FindText +
' не найден ); - gt; SetFocus ();}
//---------------------------------------------------------------------------__fastcall TForm1 :: MCopyClick (TObject * Sender)
{RichEdit1- gt; CopyToClipboard ();}
//---------------------------------------------------------------------------__fastcall TForm1 :: MCutClick (TObject * Sender)
{RichEdit1- gt; CutToClipboard ();}
//---------------------------------------------------------------------------__fastcall TForm1 :: MPasteClick (TObject * Sender)
{RichEdit1- gt; PasteFromClipboard ();}
//---------------------------------------------------------------------------__fastcall TForm1 :: MUndoClick (TObject * Sender)
{RichEdit1- gt; Undo ();}
//---------------------------------------------------------------------------__fastcall TForm1 :: ReplaceDialog1Replace (TObject * Sender)
{RichEdit1- gt; SetFocus (); (RichEdit1- gt; SelText!= )
{RichEdit1- gt; SelText=ReplaceDialog1- gt; ReplaceText; (ReplaceDialog1- gt; Options.Contains (frReplaceAll)) - gt; SelStart +=ReplaceDialog1- gt; ReplaceText.Length ();} if (ReplaceDialog1- gt; Options.Contains (frReplace))
{ShowMessage ( Текст ' + ReplaceDialog1- gt; FindText +
' не найден ) ;;} (ReplaceDialog1- gt; Options.Contains (frReplaceAll)) Find (Sender);}
//---------------------------------------------------------------------------__fastcall TForm1 :: MReplaceClick (TObject * Sender)
{ReplaceDialog1- gt; FindText=RichEdit1- gt; SelText; - gt; Execute ();}
//---------------------------------------------------------------------------__fastcall TForm1 :: MExitClick (TObject * Sender)
{Close ();}
//---------------------------------------------------------------------------__fastcall TForm1 :: FormCloseQuery (TObject * Sender, bool amp; CanClose)
{if (RichEdit1- gt; Modified)
{int res=MessageDlg ( Текст у вікні був змінений. Зберегти його? ,, () lt; lt; mbYes lt; lt; mbNo lt; lt; mbCancel, 0); ( res)
{case mrYes: MSaveClick (Sender); break; mrCancel: CanClose=false; }}}
//---------------------------------------------------------------------------__fastcall TForm1 :: MCreateClick (TObject * Sender)
{if (RichEdit1- gt; Modified)
{int res=MessageDlg ( Текст у вікні був змінений. Зберегти його? ,, () lt; lt; mbYes lt; lt; mbNo lt; lt; mbCancel, 0); ( res)
{mrYes: MSaveClick (Sender);
break; mrCancel: return;
}
} - gt; Clear ();= raquo ;;
}
//---------------------------------------------------------------------------__fastcall TForm1 :: MPrintSetupClick (TObject * Sender)
{- gt; Execute ();
}
//---------------------------------------------------------------------------__fastcall TForm1 :: MPrintClick (TObject * Sender)
{(PrintDialog1- gt; Execute ()) (int i=1; i lt;=PrintDialog1- gt; Copies; i ++) - gt; Print ( Друк PRichEdit1 );
} __ fastcall TForm1 :: ApplicationEvents1Hint (TObject * Sender)
{- gt; Panels- gt; Items [2] - gt; Text=Application- gt; Hint;
}
Практична робота 9. Програми для роботу з власним функціямі
Завдання 9.1