Thanks everyone for your answers.
As there seems to be no "proper" way to do this, I devised the following solution:
unit TRichEditRemoveSelectionBar;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
procedure RichEdit1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure RichEdit1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure RichEdit1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
B: Boolean = False;
implementation
{$R *.dfm}
// ------------------------------------------------------------------------- //
procedure TForm1.RichEdit1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if (GetCursor <> Screen.Cursors[crDefault]) and
(GetCursor <> Screen.Cursors[crIBeam]) then
begin
SetCursor(Screen.Cursors[crIBeam]);
B := True;
end else
B := False;
end;
procedure TForm1.RichEdit1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if B then
begin
SetCursor(Screen.Cursors[crIBeam]);
RichEdit1.SelLength := 0;
end;
end;
procedure TForm1.RichEdit1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if B then
SetCursor(Screen.Cursors[crIBeam]);
end;
// ------------------------------------------------------------------------- //
end.
It's not elegant at all, but it gets the job done.
Note that this code doesn't allow for a double-click full row selection and it doesn't handle triple-click full text selection. For that you'll probably have to use an interceptor class for example.