Article View: borland.public.cppbuilder.nativeapi
Article #4192Re: User clicks on Memo
From: Remy Lebeau (TeamB)
Date: Thu, 02 Mar 2006 01:52
Date: Thu, 02 Mar 2006 01:52
41 lines
1931 bytes
1931 bytes
"Jos�" <jose@127.0.0.1> wrote in message
news:997c029a5t0qjqsm19sajsj7mn1ob6jh1s@4ax.com...
> There are several lines in a Memo. User clicks on a line.
> How can I know which line it was?
Use the EM_CHARFROMPOS message:
void __fastcall TForm1::Memo1Click(TObject *Sender)
{
TPoint p = Memo1->ScreenToClient(Mouse->CursorPos);
int LineIndex = Memo1->Perform(EM_CHARFROMPOS, 0, MAKELPARAM(p.x,
p.y));
if( LineIndex > -1 )
{
LineIndex = HIWORD(LineIndex);
//...
}
}
Alternatively, use the EM_LINEFROMCHAR or EM_EXLINEFROMCHAR message:
void __fastcall TForm1::Memo1Click(TObject *Sender)
{
int LineIndex = Memo1->Perform(EM_LINEFROMCHAR, Memo1->SelStart, 0);
if( LineIndex > -1 )
// ...
}
void __fastcall TForm1::Memo1Click(TObject *Sender)
{
int LineIndex = Memo1->Perform(EM_EXLINEFROMCHAR, 0,
Memo1->SelStart);
if( LineIndex > -1 )
// ...
}
Gambit
Technical Details
Message-ID:
<4406506c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<997c029a5t0qjqsm19sajsj7mn1ob6jh1s@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,92a044aea584f07d X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <997c029a5t0qjqsm19sajsj7mn1ob6jh1s@4ax.com> Subject: Re: User clicks on Memo Date: Wed, 1 Mar 2006 17:52:09 -0800 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <4406506c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1141264492 68.69.17.41 (1 Mar 2006 17:54:52 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail