Mirror

Have a TMemo/TRichEdit scroll to the cursor position (Views: 100)


Problem/Question/Abstract:

Have a TMemo/TRichEdit scroll to the cursor position

Answer:

After placing the cursor at the desired position using the SelStart property,
you should use the EM_SCROLLCARET message to scroll the caret into view,
as shown in the piece of code below.

// scroll caret into view,
// the wParam, lParam parameters are ignored
SendMessage(Memo1.handle, EM_SCROLLCARET, 0, 0);

<< Back to main page