Delphi .NET (2) Database (71) Delphi IDE (89) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280)
Exchange Links About this site Links to us 
|
Access the current row/column of a TMemo
2 comments. Current rating: (1 votes). Leave comments and/ or rate it.
The following code reads and writes the cursor's position as row and column; counting starts at 0.
(To scroll to the cursor position, also read this tip:
Have a TMemo/ TRichEdit scroll to the cursor position.)
 | |  | | procedure GetMemoRowCol (M : TMemo; var Row, Col : LongInt);
begin
Row := SendMessage(M.Handle, EM_LINEFROMCHAR, M.SelStart, 0);
Col := M.SelStart-SendMessage(M.Handle, EM_LINEINDEX, Row, 0);
end;
procedure SetMemoRowCol(M : TMemo; Row, Col : Integer);
begin
M.SelStart := SendMessage(M.Handle, EM_LINEINDEX, Row, 0)
+ Col;
end; | |  | |  |
Content-type: text/html
Comments:
|
gutergues@gmail.com
|
 |
|
Esta dica me ajudou muito quando eu precisava posicionar o cursor em uma determinada linha...
Muito boa.
|
2008-10-12, 19:37:44 (updated: 2008-10-12, 19:38:19) |
anonymous from New Zealand
|
|
|
just what i was looking for. many thanks
|
|