| |
| Getting the current line number of a TMemo? |
 |
How can I determine the current line number of a TMemo?
You can use the Windows EM_LINEFROMCHAR message to get the current (zero based) line number (position of the caret) of any edit control.
Example:
procedure TForm .Button Click(Sender: TObject);
var
LineNumber : integer;
begin
LineNumber := SendMessage(Memo .Handle,
EM_LINEFROMCHAR,
word(- ),
0);
ShowMessage(IntToStr(LineNumber));
end;
|
|
| Hits/month |
2,500,000+ |
Downloads (Since May 2000) |
7,393,709 |
| Total Files |
6,023 |
| Forum msgs |
7,670 |
| Articles/FAQs |
70+/900+ |
Top Selling Software at Amazon
|