Главная страница | назад





Article #17417: How can I determine what is the current line number of a TMemo?

 Question and Answer Database

FAQ2417C.txt   How can I determine what is the current line number of a TMemo?
Category   :VCL
Platform    :All
Product    :C++Builder  3.x

Question:
How can I determine what is the current line number of a TMemo?

Answer:
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:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    int LineNumber;
    LineNumber = SendMessage(Memo1->Handle, EM_LINEFROMCHAR, -1 , 0);
    ShowMessage(LineNumber);
}



7/2/98 10:32:32 AM
 

Last Modified: 01-SEP-99