[Lazarus] How to find position in TMemo.lines
Henry Vermaak
henry.vermaak at gmail.com
Wed Apr 16 18:40:41 CEST 2008
On 16/04/2008, Jon Foster <jon-lists at jfpossibilities.com> wrote:
> I'm trying to determine where the which line in a TMemo the cursor is
> on. In Delphi I could use CaretPos. I didn't find anything in the
> documentation for TMemo that indicated there was any way to do this. Is
> there some way to determine the cursor position within the lines
> property of a TMemo?
>
err, this is probably a hack, but you can use pos(lineending,
memo.lines.text) in a loop to count how many newlines before you get
to memo.selstart. then rposex(lineending, memo.lines.text,
memo.selstart) to find how far you are in the line you are. works in
gtk2, at least (can send code if i don't make sense :).
henry
More information about the Lazarus
mailing list