RAD Studio |  |

Deleting Selected Text

You can delete the selected text in an edit component without cutting it to the clipboard. To do so, call the ClearSelection method. For example, if you have a Delete item on the Edit menu, your code could look like this:

Copy Code

    procedure TEditForm.Delete(Sender: TObject);
    begin
      RichEdit1.ClearSelection;
    end;

Copy Code

    void __fastcall TMainForm::EditDeleteClick(TObject *Sender)
    {
      RichEdit1->ClearSelection();
    }

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!