Page 1 of 1

Programmatically Delete

Posted: Mon Nov 30, 2009 7:38 pm
by dave novo
Hello,

I would like to perform a Delete in a TRichViewEdit programatically. If there is a selection then DeleteSelection works perfectly. However, if there is no current selection, I would like to be able to trigger the same code that would happen in the user simply pressed delete, i.e. delete the next character to the right of the cursor. Of course, there may be tables etc to the right of the cursor.

Do you have sample code that can do this?

Thanks!

Posted: Tue Dec 01, 2009 3:56 pm
by Sergey Tkachenko
SendMessage(RichViewEdit1.TopLevelEditor.Handle, WM_KEYDOWN, VK_DELETE, 0);

Posted: Tue Dec 01, 2009 11:43 pm
by dave novo
Hi Sergey,

Just as a minor request to move the code from the message handler to an actual method, and have the message handler call the method. I imagine it could be useful to expose this to users as one of your DeleteXXX methods. Maybe not though, since the fact that you have not done so by know would indicate not many people have asked for it :-)