Deleting Selected Text

From RAD Studio
Jump to: navigation, search

Go Up to Working with Text in Controls

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:

procedure TEditForm.Delete(Sender: TObject);
begin
  RichEdit1.ClearSelection;
end;
void __fastcall TMainForm::EditDeleteClick(TObject *Sender)
{
    RichEdit1->ClearSelection();
}

See Also