HideSelection (C++)

From RAD Studio Code Examples
Jump to: navigation, search


This example needs only a blank form. Three Rich Edit controls are placed vertically on the form, each containing a line of text. The second form has HideSelection set to False. Use the TAB key to move between the three Rich Edit controls and notice the effect on the selected text.


#include <ComCtrls.hpp>

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
  for (int I = 0; I <= 2; I++)
    TRichEdit *pRich = new TRichEdit(this);
    pRich->Parent = this;
    pRich->Top = pRich->Height * I;
    pRich->Text = "This text will take the focus.";
    pRich->SelStart = 0;
    pRich->SelLength = pRich->Text.Length();
    if (I == 1)
      pRich->HideSelection = false;