Article View: borland.public.cppbuilder.nativeapi
Article #12924Re: Caret position in the text
From: vERUs
Date: Thu, 06 Nov 2003 16:20
Date: Thu, 06 Nov 2003 16:20
28 lines
1634 bytes
1634 bytes
> Is there an API to be used to know the caret position, in the text
contained
> in a Memo/RichEdit area?
If you look at the TMemo properties you'll find CaretPos, this however gives
you a TPoint object.
> (more precisely, I need to know the character that
> is to the left of the caret in the Memo/RichEdit control).
To do this you ca use the SelStart, SelLength and SelText properties.
if (Memo->SelStart > 0)
{
int iSelStart = Memo->SelStart;
int iSelLength = Memo->SelLength;
Memo->SelStart--;
Memo->SelLength = 1;
AnsiString sChar = Memo->SelText;
Memo->SelStart = iSelStart;
Memo->SelLength = iSelLength;
ShowMessage(sChar);
}
/ vERUs
Technical Details
Message-ID:
<3faa7509$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp.abs.net!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3faa3567@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,b5cbbd660d312bd3 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-06 08:26:56 PST From: "vERUs" <-verus-@telia.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3faa3567@newsgroups.borland.com> Subject: Re: Caret position in the text Date: Thu, 6 Nov 2003 17:20:51 +0100 Lines: 30 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 NNTP-Posting-Host: 217.210.229.131 Message-ID: <3faa7509$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1068135689 217.210.229.131 (6 Nov 2003 08:21:29 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp.abs.net!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail