HideSelection (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example requires 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. Try using the TAB key to move between the three Rich Edit controls and observe the effect on the selected text.

Code

uses ComCtrls;

procedure TForm1.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to 2 do
    with TRichEdit.Create(Self) do
    begin
      Parent := Self;
      Top := Height * I;
      Text := 'This text will take the focus.';
      SelStart := 0;
      SelLength := Length(Text);
      if (I = 1) then
        HideSelection := False;
    end;
end;

Uses

Personal tools
Assistance