procedure ScrollToLineCol(AMemo: TCustomMemo; Line, Col: integer); var Len: integer; AdjCol: integer; CharNum: integer; begin if AMemo = nil then Exit; // Find the character number of the line requested CharNum := AMemo.Perform(EM_LINEINDEX, Line, 0); // Make sure we keep the column in this line Len := AMemo.Perform(EM_LINELENGTH, CharNum, 0); if Len > Col then AdjCol := Col else AdjCol := Len; // Add the column to the caret position AMemo.SelStart := CharNum + AdjCol; AMemo.Perform(EM_ScrollCaret, 0, 0); end;
Hopefully, this makes it easy to debug now!
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.