Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to scroll to a specific location in a TMemo

23 views
Skip to first unread message

Jim K

unread,
Jul 14, 2005, 7:12:36 PM7/14/05
to

So I know how to do this in Delphi/CBuilder but I can't seem to find a way to do this in Kylix.

In Delphi the following code would make a TMemo scroll to a specific location, in this case the 5th line from the top.
with Memo1 do
begin
SelStart := Perform(EM_LINEINDEX, 5, 0);
Perform(EM_SCROLLCARET, 0, 0);
end;

In Kylix TMemo.Perform doesn't exist. Any suggestions on how to do this would be appriciatied.

theo

unread,
Jul 15, 2005, 6:56:36 AM7/15/05
to
Jim K schrieb:

You might try:

var Cp:TCaretPos;

...

Cp.Col:=0;
Cp.Line:=5;
SampleMemo.CaretPos:=Cp;

This ensures that the cursor position is visible.

Or you might take a TSynEdit (or TSynMemo) for more control. (see
Topline property)

Jim K

unread,
Jul 15, 2005, 12:20:53 PM7/15/05
to

Changing the CaretPos works but if the file is too large the performance can be pretty bad. I'll look into the TSynMemo and thanks for the tip.

Jim

0 new messages