Hot to scroll

General TRichView support forum. Please post your questions here
Post Reply
RichardDufour
Posts: 4
Joined: Mon Nov 24, 2014 4:22 pm

Hot to scroll

Post by RichardDufour »

How would I go about to scroll to the very top or my ScaleRichview?

I unsuccessfully tried the following:
A) srv.RichViewEdit.ScrollTo(0);
B) srv.RichViewEdit.VScrollPos := 0;
C) srv.VScrollPos := 0;
Etc.

but nothing will make it scroll to the very top.

Furthermore, why would I use
A) srv.RichViewEdit.VScrollPos := 0;
VS
B) srv.VScrollPos := 0;

A bit confusing.
Which one has precedence over the other? What's the difference?
What am I doing wrong? What do I have to do to scroll to the top?

Thanks in advance for any input you can provide,
Richard
RichardDufour
Posts: 4
Joined: Mon Nov 24, 2014 4:22 pm

Post by RichardDufour »

BTW, I also unsuccessfully tried this:

// Set the scroll position to the top
ItemNo := 0;
Offs := srv.RichViewEdit.GetOffsBeforeItem(ItemNo);
srv.RichViewEdit.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);

But also didn't work.
:-(
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This code works:

Code: Select all

SRichViewEdit1.VScrollPos := 0;
What problem do you have with it?

srv.RichViewEdit.VScrollPos := 0 and srv.RichViewEdit.ScrollTo(0) are incorrect, because scrolling in internal editor does not initiate scrolling in SRV.

SetSelectionBounds scrolls to make the caret visible, so the first line will be visible after moving the caret to the beginning. But it is not necessary scrolls to the very top, because of margins and a gap between the top side and pages.
Post Reply