I’m trying to replace a "comma" with "comma + space" using the following code in a procedure called by the OnChange Event on a RichEdit control in Delphi 2010.
SomeString := RichEdit.Lines.Strings[RichEdit.Lines.Count-1];
Position := Pos(',', SomeString);
if Position > 0 then
begin
Delete(SomeString, Position, 1);
Insert(', ', SomeString, Position);
RichEdit.Lines.Strings[RichEdit.Lines.Count-1] := SomeString;
end;
It works perfectly, but I can’t use BACKSPACE and DEL via keyboard anymore (on the RichEdit Control), because the inserted characters act like barriers. It doesn’t happen with another set of inserted characters, only with "comma + space".
Can someone tell me what am I doing wrong here ?