[Lazarus] How to find position in TMemo.lines
Jon Foster
jon-lists at jfpossibilities.com
Wed Apr 23 17:11:38 CEST 2008
Henry Vermaak wrote:
> 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. [...]
> 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 :).
>
Make sense. It would be quicker to write a loop to scan the string
counting lineendings rather than using all those "pos" calls. Eliminates
the overhead of having to make those calls. Since there doesn't appear
to be any known built in solution for this I think I'll do just that.
THX - Jon
--
Jon Foster
JF Possibilities, Inc.
jon at jfpossibilities.com
541-410-2760
Making computers work for you!
More information about the Lazarus
mailing list