Aaron
Aaron

Reputation: 906

Why does my caret not return to the beginning of a TRichViewEdit?

I'm using a TRichViewEdit for a chat application and after sending the text in the Edit I clear it. The problem is after I clear the Edit the caret appears at the end of the last item. If I click on the Edit or start typing again, the caret returns to the beginning. Why is it not moving back right away?

I've tried calling RichViewEdit.Update and .SelectWordAt(0,0) and neither of those seems to work.

Example: enter image description here

Upvotes: 2

Views: 386

Answers (2)

Steve F
Steve F

Reputation: 1567

Do this:

RichViewEdit1.Clear; 
RichViewEdit1.Format; 

Upvotes: 2

Aaron
Aaron

Reputation: 906

So I found a workaround by calling RVEdit.SetSelectionBounds(0,0,0,0) after the clear, it moves the caret back to the beginning of the edit box.

Upvotes: 2

Related Questions